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/18 01:33:00 UTC
[shardingsphere] branch master updated: Proofread ALTER SEQUENCE grammar + add test cases (#19291)
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 888b43ac47c Proofread ALTER SEQUENCE grammar + add test cases (#19291)
888b43ac47c is described below
commit 888b43ac47c4612d1bbf90bbca778caf459c77ec
Author: Everly Precia Suresh <77...@users.noreply.github.com>
AuthorDate: Mon Jul 18 07:02:55 2022 +0530
Proofread ALTER SEQUENCE grammar + add test cases (#19291)
---
.../src/main/antlr4/imports/postgresql/BaseRule.g4 | 11 ++++-------
.../src/main/antlr4/imports/postgresql/DDLStatement.g4 | 2 +-
.../src/main/resources/case/ddl/alter-sequence.xml | 3 +++
.../src/main/resources/sql/supported/ddl/alter-sequence.xml | 3 +++
.../src/main/resources/sql/unsupported/unsupported.xml | 1 -
5 files changed, 11 insertions(+), 9 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 228043fe0fd..1c0029e0e2d 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
@@ -1598,14 +1598,11 @@ seqOptList
seqOptElem
: AS simpleTypeName
| CACHE numericOnly
- | CYCLE
- | NO CYCLE
+ | NO? CYCLE
| INCREMENT BY? numericOnly
- | MAXVALUE numericOnly
- | MINVALUE numericOnly
- | NO MAXVALUE
- | NO MINVALUE
- | OWNED BY anyName
+ | (MAXVALUE | MINVALUE) numericOnly
+ | NO (MAXVALUE | MINVALUE)
+ | OWNED BY (anyName | NONE)
| SEQUENCE NAME anyName
| START WITH? numericOnly
| RESTART
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/DDLStatement.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/DDLStatement.g4
index 3387a2c42bd..022f6ddaf27 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/DDLStatement.g4
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/DDLStatement.g4
@@ -1038,7 +1038,7 @@ alterSequence
;
alterSequenceClauses
- : alterTableCmds | seqOptList | RENAME TO name | SET SCHEMA name
+ : OWNER TO roleSpec | seqOptList | RENAME TO name | SET SCHEMA name
;
alterServer
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/alter-sequence.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/alter-sequence.xml
index 358dc843d75..7d290f0a629 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/alter-sequence.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/alter-sequence.xml
@@ -18,4 +18,7 @@
<sql-parser-test-cases>
<alter-sequence sql-case-id="alter_sequence" />
+ <alter-sequence sql-case-id="alter_sequence_rename_to" />
+ <alter-sequence sql-case-id="alter_sequence_owner_to" />
+ <alter-sequence sql-case-id="alter_sequence_no_cycle" />
</sql-parser-test-cases>
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/alter-sequence.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/alter-sequence.xml
index 339041ec25e..6a7bd0c7045 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/alter-sequence.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/alter-sequence.xml
@@ -18,4 +18,7 @@
<sql-cases>
<sql-case id="alter_sequence" value="ALTER SEQUENCE seq_id MINVALUE 10" db-types="PostgreSQL,openGauss,SQLServer,Oracle" />
+ <sql-case id="alter_sequence_rename_to" value="ALTER SEQUENCE seq1 RENAME TO seq2;" db-types="PostgreSQL" />
+ <sql-case id="alter_sequence_owner_to" value="ALTER SEQUENCE seq1 OWNER TO CURRENT_USER;" db-types="PostgreSQL" />
+ <sql-case id="alter_sequence_no_cycle" value="ALTER SEQUENCE IF EXISTS seq1 NO CYCLE;" db-types="PostgreSQL" />
</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 179ba2bd232..51268e03f29 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
@@ -3318,7 +3318,6 @@
<sql-case id="alter_by_postgresql_source_test_case214" value="ALTER OPERATOR FAMILY alt_opf7 USING btree DROP OPERATOR 1 (int4, int2, int8);" db-types="PostgreSQL" />
<sql-case id="alter_by_postgresql_source_test_case215" value="ALTER OPERATOR FAMILY alt_opf8 USING btree ADD OPERATOR 1 < (int4, int4);" db-types="PostgreSQL" />
<sql-case id="alter_by_postgresql_source_test_case216" value="ALTER OPERATOR FAMILY alt_opf9 USING gist ADD OPERATOR 1 < (int4, int4) FOR ORDER BY float_ops;" db-types="PostgreSQL" />
- <sql-case id="alter_by_postgresql_source_test_case295" value="ALTER SEQUENCE itest6_a_seq OWNED BY NONE;" db-types="PostgreSQL" />
<sql-case id="alter_by_postgresql_source_test_case296" value="ALTER SERVER alt_fserv1 RENAME TO alt_fserv2;" db-types="PostgreSQL" />
<sql-case id="alter_by_postgresql_source_test_case297" value="ALTER SERVER alt_fserv1 RENAME TO alt_fserv3;" db-types="PostgreSQL" />
<sql-case id="alter_by_postgresql_source_test_case298" value="ALTER SERVER s0;" db-types="PostgreSQL" />