This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new e4697b917d4 Enhance system variable query lexical rules (#26886)
e4697b917d4 is described below
commit e4697b917d4e13d60756ff53fcc02cec3f1742bf
Author: niu niu <[email protected]>
AuthorDate: Fri Jul 14 10:05:40 2023 +0800
Enhance system variable query lexical rules (#26886)
---
.../dialect/mysql/src/main/antlr4/imports/mysql/BaseRule.g4 | 1 +
test/it/parser/src/main/resources/case/dml/select.xml | 10 ++++++++++
test/it/parser/src/main/resources/sql/supported/dml/select.xml | 1 +
3 files changed, 12 insertions(+)
diff --git a/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/BaseRule.g4
b/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/BaseRule.g4
index 80aeac479ea..d2c0fb9373b 100644
--- a/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/BaseRule.g4
+++ b/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/BaseRule.g4
@@ -194,6 +194,7 @@ identifierKeywordsUnambiguous
| DAY
| DAY_MINUTE
| DEFAULT_AUTH
+ | DEFAULT
| DEFINER
| DEFINITION
| DELAY_KEY_WRITE
diff --git a/test/it/parser/src/main/resources/case/dml/select.xml
b/test/it/parser/src/main/resources/case/dml/select.xml
index ad684eaf3ee..bf729eb7fe9 100644
--- a/test/it/parser/src/main/resources/case/dml/select.xml
+++ b/test/it/parser/src/main/resources/case/dml/select.xml
@@ -170,6 +170,16 @@
</projections>
</select>
+ <select sql-case-id="select_global_default_key_buffer_size">
+ <projections start-index="7" stop-index="40">
+ <expression-projection text="@@global.default.`key_buffer_size`"
start-index="7" stop-index="40">
+ <expr>
+ <variable-segment start-index="7" stop-index="40"
scope="global" variable="default.`key_buffer_size`" />
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
<select sql-case-id="select_with_exist_in">
<projections start-index="7" stop-index="93">
<expression-projection text="+0
IN(0b111111111111111111111111111111111111111111111111111,rpad(1.0,2048,1),32767.1)"
start-index="7" stop-index="93">
diff --git a/test/it/parser/src/main/resources/sql/supported/dml/select.xml
b/test/it/parser/src/main/resources/sql/supported/dml/select.xml
index edc573f2865..6b23c80752c 100644
--- a/test/it/parser/src/main/resources/sql/supported/dml/select.xml
+++ b/test/it/parser/src/main/resources/sql/supported/dml/select.xml
@@ -25,6 +25,7 @@
<sql-case id="select_convert_function4" value="SELECT CONVERT(TIMESTAMP
"2004-01-22 21:45:33", CHAR)" db-types="MySQL" />
<sql-case id="select_function_aes_decrypt_and_aes_encrypt" value="SELECT
AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @keys, @Iv), @keys, @Iv)=@ENCSTR FROM t1"
db-types="MySQL" />
<sql-case id="select_user_variable_before_after" value="SELECT
@before=@after" db-types="MySQL" />
+ <sql-case id="select_global_default_key_buffer_size" value="SELECT
@@global.default.`key_buffer_size`" db-types="MySQL" />
<sql-case id="select_with_exist_in" value="SELECT (+0
IN(0b111111111111111111111111111111111111111111111111111,rpad(1.0,2048,1),32767.1))"
db-types="MySQL" />
<sql-case id="select_constant_without_table" value="SELECT 1 as a"
db-types="MySQL, PostgreSQL,openGauss, SQLServer" />
<sql-case id="select_with_operator_ilike" value="SELECT id from t_order
where name !~ '^pg_toast'" db-types="PostgreSQL,openGauss" />