You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by ji...@apache.org on 2023/06/20 10:07:14 UTC

[shardingsphere] branch master updated: fix: add keyword SYSTEM (#26261)

This is an automated email from the ASF dual-hosted git repository.

jianglongtao 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 8ace1fc15db fix: add keyword SYSTEM (#26261)
8ace1fc15db is described below

commit 8ace1fc15db09dc5d5c3fbf21527c62b6130e822
Author: cardigan1008 <87...@users.noreply.github.com>
AuthorDate: Tue Jun 20 18:07:07 2023 +0800

    fix: add keyword SYSTEM (#26261)
---
 .../src/main/antlr4/imports/mysql/BaseRule.g4      |  1 +
 .../parser/src/main/resources/case/dml/select.xml  | 23 ++++++++++++++++++++++
 .../main/resources/sql/supported/dml/select.xml    |  1 +
 3 files changed, 25 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 41e4331fd13..ca0e9219de8 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
@@ -456,6 +456,7 @@ identifierKeywordsUnambiguous
     | SUSPEND
     | SWAPS
     | SWITCHES
+    | SYSTEM
     | TABLES
     | TABLESPACE
     | TABLE_CHECKSUM
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 0148e7c3fab..42e0aad83c4 100644
--- a/test/it/parser/src/main/resources/case/dml/select.xml
+++ b/test/it/parser/src/main/resources/case/dml/select.xml
@@ -4978,4 +4978,27 @@
             <simple-table name="DUAL" start-index="19" stop-index="22" />
         </from>
     </select>
+    
+    <select sql-case-id="select_with_keyword_system" parameters="0">
+        <from>
+            <simple-table name="vtx_project" start-index="14" stop-index="24" />
+        </from>
+        <projections start-index="7" stop-index="7">
+            <shorthand-projection start-index="7" stop-index="7" />
+        </projections>
+        <where start-index="26" stop-index="41">
+            <expr>
+                <binary-operation-expression start-index="32" stop-index="41">
+                    <left>
+                        <column name="system" start-index="32" stop-index="37"/>
+                    </left>
+                    <operator>=</operator>
+                    <right>
+                        <literal-expression value="0" start-index="41" stop-index="41"/>
+                        <parameter-marker-expression parameter-index="0" start-index="41" stop-index="41"/>
+                    </right>
+                </binary-operation-expression>
+            </expr>
+        </where>
+    </select>
 </sql-parser-test-cases>
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 1887fe0d229..dee2129d916 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
@@ -163,4 +163,5 @@
     <sql-case id="select_constant_with_nested_type_cast" value="SELECT CAST(MONEY '1' AS VARCHAR)::CHAR(10)::VARCHAR::CHAR(4)" db-types="PostgreSQL,openGauss"  />
     <sql-case id="select_projection_with_parameter" value="SELECT 1 AS id, ? AS status, SYSDATE AS create_time, TRUNC(SYSDATE) AS create_date FROM DUAL" db-types="Oracle"  />
     <sql-case id="select_with_chinese_comma" value="SELECT 1, 2,3 FROM DUAL" db-types="Oracle"  />
+    <sql-case id="select_with_keyword_system" value="SELECT * FROM vtx_project WHERE system = ?" />
 </sql-cases>