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 2022/07/11 03:24:13 UTC

[shardingsphere] branch master updated: Fix parse column with national (#19011)

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 a78acb22d05 Fix parse column with national (#19011)
a78acb22d05 is described below

commit a78acb22d0553e7bc994155adb23fa6f354d6693
Author: Chuxin Chen <ch...@qq.com>
AuthorDate: Mon Jul 11 11:24:08 2022 +0800

    Fix parse column with national (#19011)
---
 .../src/main/antlr4/imports/opengauss/BaseRule.g4                  | 1 +
 .../src/main/antlr4/imports/postgresql/BaseRule.g4                 | 1 +
 .../src/main/resources/case/ddl/create-table.xml                   | 7 +++++++
 .../src/main/resources/sql/supported/ddl/create-table.xml          | 1 +
 4 files changed, 10 insertions(+)

diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/imports/opengauss/BaseRule.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/imports/opengauss/BaseRule.g4
index 95ba5f42b6c..3df1b44a379 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/imports/opengauss/BaseRule.g4
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/imports/opengauss/BaseRule.g4
@@ -274,6 +274,7 @@ unreservedWord
     | MOD
     | NAME
     | NAMES
+    | NATIONAL
     | NEW
     | NEXT
     | NFC
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4
index c622e5b78c0..228043fe0fd 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4
@@ -275,6 +275,7 @@ unreservedWord
     | MOD
     | NAME
     | NAMES
+    | NATIONAL
     | NEW
     | NEXT
     | NFC
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/create-table.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/create-table.xml
index 7505c008d07..acd57bfc903 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/create-table.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/create-table.xml
@@ -1751,4 +1751,11 @@
             <column name="path" />
         </column-definition>
     </create-table>
+
+    <create-table sql-case-id="create_table_national">
+        <table name="t_order" start-index="13" stop-index="19" />
+        <column-definition type="int" start-index="22" stop-index="33">
+            <column name="national" />
+        </column-definition>
+    </create-table>
 </sql-parser-test-cases>
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/create-table.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/create-table.xml
index 96cbc101d96..8c35d572d62 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/create-table.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/create-table.xml
@@ -124,4 +124,5 @@
     <sql-case id="create_bit_xor_table" value="create table BIT_XOR(a int)" db-types="MySQL" />
     <sql-case id="create_bit_xor_table_with_space" value="create table BIT_XOR (a int)" db-types="MySQL" />
     <sql-case id="create_table_path" value="CREATE TABLE files (path PATH);" db-types="PostgreSQL" />
+    <sql-case id="create_table_national" value="CREATE TABLE t_order (national int);" db-types="PostgreSQL,openGauss" />
 </sql-cases>