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 b9ad90f531f Support PostgreSQL COLLATION and CONSTRAINT keywords
(#31027)
b9ad90f531f is described below
commit b9ad90f531ff504d1d7560bea16ee81c34709813
Author: LotusMoon <[email protected]>
AuthorDate: Sat Apr 27 07:26:34 2024 +0800
Support PostgreSQL COLLATION and CONSTRAINT keywords (#31027)
---
.../postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4 | 2 ++
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, 13 insertions(+)
diff --git
a/parser/sql/dialect/postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4
b/parser/sql/dialect/postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4
index 0011b4a935d..8774b57574b 100644
---
a/parser/sql/dialect/postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4
+++
b/parser/sql/dialect/postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4
@@ -441,6 +441,8 @@ unreservedWord
| JSON
| PARAM
| TABLE
+ | CONSTRAINT
+ | COLLATION
;
typeFuncNameKeyword
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 7194cd80d96..2d65a87228c 100644
--- a/test/it/parser/src/main/resources/case/dml/select.xml
+++ b/test/it/parser/src/main/resources/case/dml/select.xml
@@ -9377,4 +9377,14 @@
<simple-table name="table1" start-index="19" stop-index="24"/>
</from>
</select>
+
+ <select sql-case-id="select_with_collation_keyword">
+ <projections start-index="7" stop-index="59">
+ <column-projection name="pg_get_expr" start-index="7"
stop-index="32" alias="CONSTRAINT"/>
+ <column-projection name="indcollation" start-index="35"
stop-index="59" alias="COLLATION"/>
+ </projections>
+ <from start-index="66" stop-index="73">
+ <simple-table name="pg_index" start-index="66" stop-index="73"/>
+ </from>
+ </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 e50cc640204..4cd3faf83ec 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
@@ -276,4 +276,5 @@
<sql-case id="select_with_multi_arbitrary_match" value="SELECT
Person1.name AS PersonName, STRING_AGG(Person2.name, '->') WITHIN GROUP (GRAPH
PATH) AS Friends, Restaurant.name FROM Person AS Person1, friendOf FOR PATH AS
fo, Person FOR PATH AS Person2, likes, Restaurant WHERE
MATCH(SHORTEST_PATH(Person1(-(fo)->Person2){1,3}) AND
LAST_NODE(Person2)-(likes)->Restaurant ) AND Person1.name = 'Jacob' AND
Restaurant.name = 'Ginger and Spice'" db-types="SQLServer"/>
<sql-case id="select_hour_from_table" value="select hour from table1"
db-types="SQLServer"/>
<sql-case id="select_minute_from_table" value="select minute from table1"
db-types="SQLServer"/>
+ <sql-case id="select_with_collation_keyword" value="SELECT pg_get_expr AS
CONSTRAINT ,indcollation AS COLLATION FROM pg_index" db-types="PostgreSQL"/>
</sql-cases>