You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2023/03/01 05:15:13 UTC
[shardingsphere] branch master updated: Fixes #24053. (#24396)
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 705bc0e6b41 Fixes #24053. (#24396)
705bc0e6b41 is described below
commit 705bc0e6b41567c13d079713da60031c7e1b6a80
Author: Raigor <ra...@gmail.com>
AuthorDate: Wed Mar 1 13:15:05 2023 +0800
Fixes #24053. (#24396)
---
.../src/main/antlr4/imports/mysql/BaseRule.g4 | 2 +-
.../main/resources/case/dml/select-expression.xml | 26 ++++++++++++++++++++++
.../sql/supported/dml/select-expression.xml | 1 +
3 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/sql-parser/dialect/mysql/src/main/antlr4/imports/mysql/BaseRule.g4 b/sql-parser/dialect/mysql/src/main/antlr4/imports/mysql/BaseRule.g4
index 0276493cb58..ed7ef7c549b 100644
--- a/sql-parser/dialect/mysql/src/main/antlr4/imports/mysql/BaseRule.g4
+++ b/sql-parser/dialect/mysql/src/main/antlr4/imports/mysql/BaseRule.g4
@@ -1081,7 +1081,7 @@ completeRegularFunction
;
regularFunctionName
- : IF | LOCALTIME | LOCALTIMESTAMP | REPLACE | INTERVAL | MOD
+ : IF | LOCALTIME | LOCALTIMESTAMP | REPLACE | INSERT | INTERVAL | MOD
| DATABASE | SCHEMA | LEFT | RIGHT | DATE | DAY | GEOMETRYCOLLECTION
| LINESTRING | MULTILINESTRING | MULTIPOINT | MULTIPOLYGON | POINT | POLYGON
| TIME | TIMESTAMP | TIMESTAMP_ADD | TIMESTAMP_DIFF | DATE | CURRENT_TIMESTAMP
diff --git a/test/it/parser/src/main/resources/case/dml/select-expression.xml b/test/it/parser/src/main/resources/case/dml/select-expression.xml
index 8eea084b322..64d71232ecc 100644
--- a/test/it/parser/src/main/resources/case/dml/select-expression.xml
+++ b/test/it/parser/src/main/resources/case/dml/select-expression.xml
@@ -2062,6 +2062,32 @@
</expression-item>
</order-by>
</select>
+
+ <select sql-case-id="select_with_insert_function">
+ <from>
+ <simple-table name="t_order" start-index="50" stop-index="56" />
+ </from>
+ <projections start-index="7" stop-index="43">
+ <expression-projection text="INSERT(phone, 4, 3, '***')" alias="phone" start-index="7" stop-index="43">
+ <expr>
+ <function function-name="INSERT" text="INSERT(phone, 4, 3, '***')" start-index="7" stop-index="32">
+ <parameter>
+ <column name="phone" start-index="14" stop-index="18" />
+ </parameter>
+ <parameter>
+ <literal-expression value="4" start-index="21" stop-index="21" />
+ </parameter>
+ <parameter>
+ <literal-expression value="3" start-index="24" stop-index="24" />
+ </parameter>
+ <parameter>
+ <literal-expression value="***" start-index="27" stop-index="31" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
<select sql-case-id="select_with_regular_function">
<from>
diff --git a/test/it/parser/src/main/resources/sql/supported/dml/select-expression.xml b/test/it/parser/src/main/resources/sql/supported/dml/select-expression.xml
index 30463401e0a..17ff5f14de1 100644
--- a/test/it/parser/src/main/resources/sql/supported/dml/select-expression.xml
+++ b/test/it/parser/src/main/resources/sql/supported/dml/select-expression.xml
@@ -87,6 +87,7 @@
<sql-case id="select_with_amp" value="select 1 & 1" db-types="PostgreSQL,openGauss" />
<sql-case id="select_with_vertical_bar" value="select 1 | 1" db-types="PostgreSQL,openGauss" />
<sql-case id="select_with_abs_function" value="SELECT ABS(1) FROM t_order WHERE ABS(1) > 1 GROUP BY ABS(1) ORDER BY ABS(1)" db-types="MySQL,Oracle" />
+ <sql-case id="select_with_insert_function" value="SELECT INSERT(phone, 4, 3, '***') AS 'phone' FROM t_order" db-types="MySQL" />
<sql-case id="select_with_regular_function" value="SELECT A(1) FROM t_order WHERE A(1) = 1 GROUP BY A(order_id) ORDER BY A(order_id)" db-types="MySQL,Oracle,SQLServer" />
<sql-case id="select_with_regular_function_for_sql92" value="SELECT A(1) FROM t_order WHERE A(1) = 1" db-types="MySQL,Oracle,SQLServer,H2,SQL92" />
<sql-case id="select_with_regular_function_utc_timestamp" value="SELECT TIMEDIFF(NOW(), UTC_TIMESTAMP())" db-types="MySQL" />