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/08 05:54:01 UTC
[shardingsphere] branch master updated: fix parsing column name is path (#18950)
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 aaa4508695b fix parsing column name is path (#18950)
aaa4508695b is described below
commit aaa4508695b528c6e420350e98d4fdb84264d145
Author: Chuxin Chen <ch...@qq.com>
AuthorDate: Fri Jul 8 13:53:56 2022 +0800
fix parsing column name is path (#18950)
* fix column name is path
* fix column name is path
---
.../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 | 2 +-
.../src/main/resources/sql/supported/ddl/drop-table.xml | 1 +
.../src/main/resources/sql/unsupported/unsupported.xml | 5 -----
5 files changed, 10 insertions(+), 6 deletions(-)
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 30794464fc5..c622e5b78c0 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
@@ -307,6 +307,7 @@ unreservedWord
| PARTITION
| PASSING
| PASSWORD
+ | PATH
| PLAIN
| PLANS
| POLICY
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 4b092453ef9..7505c008d07 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
@@ -1744,4 +1744,11 @@
<column name="a" />
</column-definition>
</create-table>
+
+ <create-table sql-case-id="create_table_path">
+ <table name="files" start-index="13" stop-index="17" />
+ <column-definition type="PATH" start-index="20" stop-index="28">
+ <column name="path" />
+ </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 8b69dac0e85..96cbc101d96 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
@@ -123,5 +123,5 @@
<sql-case id="create_table_with_chinese_word_with_quote" value="CREATE TABLE "测试表"(id int PRIMARY KEY, status varchar(10))" db-types="Oracle,PostgreSQL,openGauss,SQLServer,SQL92" />
<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="drop_bit_xor_table" value="drop table BIT_XOR" db-types="MySQL" />
+ <sql-case id="create_table_path" value="CREATE TABLE files (path PATH);" db-types="PostgreSQL" />
</sql-cases>
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/drop-table.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/drop-table.xml
index abea94ce0e2..95110efb833 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/drop-table.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/drop-table.xml
@@ -32,4 +32,5 @@
<sql-case id="drop_table_with_quota" value="DROP TABLE "t_order"" db-types="Oracle" />
<sql-case id="drop_table_with_double_quota" value="DROP TABLE "t_order"" db-types="PostgreSQL,openGauss" />
<sql-case id="drop_table_with_bracket" value="DROP TABLE [t_order]" db-types="SQLServer" />
+ <sql-case id="drop_bit_xor_table" value="drop table BIT_XOR" db-types="MySQL" />
</sql-cases>
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/unsupported/unsupported.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/unsupported/unsupported.xml
index e8c11ba77a3..69495505b64 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/unsupported/unsupported.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/unsupported/unsupported.xml
@@ -5401,7 +5401,6 @@
<sql-case id="select_by_postgresql_source_test_case820" value="SELECT f1, date_part('microsecond', f1) AS microsecond, date_part('millisecond', f1) AS millisecond, date_part('second', f1) AS second, date_part('epoch', f1) AS epoch FROM INTERVAL_TBL;" db-types="PostgreSQL" />
<sql-case id="select_by_postgresql_source_test_case821" value="SELECT f1, @-@ f1 FROM PATH_TBL;" db-types="PostgreSQL" />
<sql-case id="select_by_postgresql_source_test_case823" value="SELECT f1, f1::box FROM POLYGON_TBL;" db-types="PostgreSQL" />
- <sql-case id="select_by_postgresql_source_test_case824" value="SELECT f1, f1::path FROM POLYGON_TBL;" db-types="PostgreSQL" />
<sql-case id="select_by_postgresql_source_test_case825" value="SELECT f1, f1::polygon FROM CIRCLE_TBL WHERE f1 >= '<(0,0),1>';" db-types="PostgreSQL" />
<sql-case id="select_by_postgresql_source_test_case826" value="SELECT f1, f1::polygon FROM PATH_TBL WHERE isclosed(f1);" db-types="PostgreSQL" />
<sql-case id="select_by_postgresql_source_test_case827" value="SELECT f1, f1::polygon FROM PATH_TBL WHERE isopen(f1);" db-types="PostgreSQL" />
@@ -5901,7 +5900,6 @@
<sql-case id="with_by_postgresql_source_test_case1" value="WITH RECURSIVE outermost(x) AS ( WITH innermost as (SELECT 2 FROM outermos SELECT * FROM innermost UNION SELECT * from outermost ) SELECT * FROM outermost ORDER BY 1;" db-types="PostgreSQL" />
<sql-case id="with_by_postgresql_source_test_case2" value="WITH RECURSIVE t(id, path) AS ( VALUES(1,ARRAY[]::integer[]) UNION ALL SELECT tree.id, t.path || tree.id FROM tree JOIN t ON (tree.parent_id = t.id) ) SELECT t1.*, t2.* FROM t AS t1 JOIN t AS t2 ON (t1.path[1] = t2.path[1] AND array_upper(t1.path,1) = 1 AND array_upper(t2.path,1) > 1) ORDER BY t1.id, t2.id;" db-types="PostgreSQL" />
<sql-case id="with_by_postgresql_source_test_case3" value="WITH RECURSIVE t(id, path) AS ( VALUES(1,ARRAY[]::integer[]) UNION ALL SELECT tree.id, t.path || tree.id FROM tree JOIN t ON (tree.parent_id = t.id) ) SELECT t1.id, count(t2.*) FROM t AS t1 JOIN t AS t2 ON (t1.path[1] = t2.path[1] AND array_upper(t1.path,1) = 1 AND array_upper(t2.path,1) > 1) GROUP BY t1.id ORDER BY t1.id;" db-types="PostgreSQL" />
- <sql-case id="with_by_postgresql_source_test_case4" value="WITH RECURSIVE t(id, path) AS ( VALUES(1,ARRAY[]::integer[]) UNION ALL SELECT tree.id, t.path || tree.id FROM tree JOIN t ON (tree.parent_id = t.id) ) SELECT t1.id, t2.path, t2 FROM t AS t1 JOIN t AS t2 ON (t1.id=t2.id);" db-types="PostgreSQL" />
<sql-case id="with_by_postgresql_source_test_case5" value="WITH RECURSIVE t(n) AS ( VALUES (1::money) UNION SELECT n+1::money FROM t WHERE n < 100::money ) SELECT sum(n) FROM t;" db-types="PostgreSQL" />
<sql-case id="with_by_postgresql_source_test_case7" value="WITH objects (classid, objid, objsubid) AS (VALUES ('pg_class'::regclass, 0, ('pg_class'::regclass, 'pg_class'::regclass, 1 ('pg_proc'::regclass, 0, ('pg_type'::regclass, 0, ('pg_cast'::regclass, 0, ('pg_collation'::regclass, 0, ('pg_constraint'::regclass, 0, ('pg_conversion'::regclass, 0, ('pg_at [...]
<sql-case id="with_by_postgresql_source_test_case8" value="WITH objects (type, name, args) AS (VALUES ('table', '{addr_nsp, gentable}'::text[], '{}'::text[]), ('table', '{addr_nsp, parttable}'::text[], '{}'::text[]), ('index', '{addr_nsp, gentable_pkey}', '{}'), ('index', '{addr_nsp, parttable_pkey}', '{}'), ('sequence', '{addr_nsp [...]
@@ -7271,9 +7269,6 @@
<sql-case id="low_with_by_postgresql_source_test_case24" value="with recursive search_graph(f, t, label) as ( select * from graph0 g union all select g.* from graph0 g, search_graph sg where g.f = sg.t ) search depth first by foo, tar set seq select * from search_graph;" db-types="PostgreSQL" />
<sql-case id="low_with_by_postgresql_source_test_case25" value="with recursive search_graph(f, t, label) as ( select * from graph0 g union distinct select g.* from graph0 g, search_graph sg where g.f = sg.t ) search breadth first by f, t set seq select * from search_graph order by seq;" db-types="PostgreSQL" />
<sql-case id="low_with_by_postgresql_source_test_case26" value="with recursive search_graph(f, t, label) as ( select * from graph0 g union distinct select g.* from graph0 g, search_graph sg where g.f = sg.t ) search depth first by f, t set seq select * from search_graph order by seq;" db-types="PostgreSQL" />
- <sql-case id="low_with_by_postgresql_source_test_case27" value="with recursive search_graph(f, t, label, is_cycle, path) as ( select *, false, array[row(g.f, g.t)] from graph g union all select g.*, row(g.f, g.t) = any(path), path || row(g.f, g.t) from graph g, search_graph sg where g.f = sg.t and not is_cycle ) select * from search_graph order by path;" db-types="PostgreSQL" />
- <sql-case id="low_with_by_postgresql_source_test_case28" value="with recursive search_graph(f, t, label, is_cycle, path) as ( select *, false, array[row(g.f, g.t)] from graph g union all select g.*, row(g.f, g.t) = any(path), path || row(g.f, g.t) from graph g, search_graph sg where g.f = sg.t and not is_cycle ) select * from search_graph;" db-types="PostgreSQL" />
- <sql-case id="low_with_by_postgresql_source_test_case29" value="with recursive search_graph(f, t, label, is_cycle, path) as ( select *, false, array[row(g.f, g.t)] from graph g union distinct select g.*, row(g.f, g.t) = any(path), path || row(g.f, g.t) from graph g, search_graph sg where g.f = sg.t and not is_cycle ) select * from search_graph;" db-types="PostgreSQL" />
<sql-case id="low_with_by_postgresql_source_test_case32" value="with testdata(bits) as (values (x'00000000'), (x'00800000'), (x'00800001'), (x'00800004'), (x'00800005'), (x'00800006'), (x'008002f1'), (x'008002f2'), (x'008002f3'), (x'00800e17'), (x'00800e18'), (x'00800e19'), (x'01000001'), (x'01102843'), (x'01a52c98'), (x&a [...]
<sql-case id="low_with_by_postgresql_source_test_case33" value="with testdata(bits) as (values (x'00000001'), (x'00000002'), (x'00000003'), (x'00000010'), (x'00000011'), (x'00000100'), (x'00000101'), (x'00004000'), (x'00004001'), (x'00080000'), (x'00080001'), (x'0053c4f4') (x'006c85c4') (x'0041ca76') (x'004b7678') (x&a [...]
<sql-case id="assertDistSQLShowRuleParseConflict" value="SHOW READWRITE_SPLITTING RULE FROM schema_name" db-types="PostgreSQL,openGauss" />