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 a2b115574e8 Support Oracle alter table moveTableClause syntax (#27987)
a2b115574e8 is described below
commit a2b115574e8383e065d50123ea68f7c4609c49c9
Author: niu niu <[email protected]>
AuthorDate: Wed Aug 9 18:08:04 2023 +0800
Support Oracle alter table moveTableClause syntax (#27987)
---
.../src/main/antlr4/imports/oracle/DDLStatement.g4 | 6 ++++
.../src/main/resources/case/ddl/alter-table.xml | 36 +++++++++++++++++++++-
.../resources/sql/supported/ddl/alter-table.xml | 8 ++++-
3 files changed, 48 insertions(+), 2 deletions(-)
diff --git
a/parser/sql/dialect/oracle/src/main/antlr4/imports/oracle/DDLStatement.g4
b/parser/sql/dialect/oracle/src/main/antlr4/imports/oracle/DDLStatement.g4
index 0725a881bb2..11b9595554d 100644
--- a/parser/sql/dialect/oracle/src/main/antlr4/imports/oracle/DDLStatement.g4
+++ b/parser/sql/dialect/oracle/src/main/antlr4/imports/oracle/DDLStatement.g4
@@ -392,6 +392,7 @@ tableAlias
alterDefinitionClause
: (alterTableProperties
| columnClauses
+ | moveTableClause
| constraintClauses
| alterTablePartitioning ((DEFERRED| IMMEDIATE) INVALIDATION)?
| alterExternalTable)?
@@ -486,6 +487,11 @@ renameColumnClause
: RENAME COLUMN columnName TO columnName
;
+moveTableClause
+ : MOVE filterCondition? ONLINE? segmentAttributesClause? tableCompression?
indexOrgTableClause? ((lobStorageClause | varrayColProperties)+)?
parallelClause? allowDisallowClustering?
+ ( UPDATE INDEXES (LP_ indexName (segmentAttributesClause |
updateIndexPartition) RP_ (COMMA_ indexName (segmentAttributesClause |
updateIndexPartition))*)?)?
+ ;
+
constraintClauses
: addConstraintSpecification | modifyConstraintClause |
renameConstraintClause | dropConstraintClause+
;
diff --git a/test/it/parser/src/main/resources/case/ddl/alter-table.xml
b/test/it/parser/src/main/resources/case/ddl/alter-table.xml
index b333a2721f8..bc953da953e 100644
--- a/test/it/parser/src/main/resources/case/ddl/alter-table.xml
+++ b/test/it/parser/src/main/resources/case/ddl/alter-table.xml
@@ -1267,9 +1267,43 @@
<table name="t_order" start-index="12" stop-index="18" />
</alter-table>
- <alter-table sql-case-id="alter_table_add_supplemental_log_group">
+ <alter-table sql-case-id="alter_table_add_supplemental_log_group1">
<table name="EMPLOYEES" start-index="12" stop-index="23">
<owner start-index="12" stop-index="13" name="HR" />
</table>
</alter-table>
+
+ <alter-table sql-case-id="alter_table_add_supplemental_log_group2">
+ <table name="EMPLOYEES" start-index="12" stop-index="23">
+ <owner start-index="12" stop-index="13" name="HR" />
+ </table>
+ </alter-table>
+
+ <alter-table sql-case-id="alter_table_add_supplemental_log_group3">
+ <table name="EMPLOYEES" start-index="12" stop-index="23">
+ <owner start-index="12" stop-index="13" name="HR" />
+ </table>
+ </alter-table>
+
+ <alter-table sql-case-id="alter_table_add_supplemental_log_data1">
+ <table name="EMPLOYEES" start-index="12" stop-index="23">
+ <owner start-index="12" stop-index="13" name="HR" />
+ </table>
+ </alter-table>
+
+ <alter-table sql-case-id="alter_table_add_supplemental_log_data2">
+ <table name="EMPLOYEES" start-index="12" stop-index="23">
+ <owner start-index="12" stop-index="13" name="HR" />
+ </table>
+ </alter-table>
+
+ <alter-table sql-case-id="alter_table_add_supplemental_log_data3">
+ <table name="EMPLOYEES" start-index="12" stop-index="23">
+ <owner start-index="12" stop-index="13" name="HR" />
+ </table>
+ </alter-table>
+
+ <alter-table sql-case-id="alter_table_move">
+ <table name="admin_docindex" start-index="12" stop-index="25" />
+ </alter-table>
</sql-parser-test-cases>
diff --git
a/test/it/parser/src/main/resources/sql/supported/ddl/alter-table.xml
b/test/it/parser/src/main/resources/sql/supported/ddl/alter-table.xml
index 2a96944dafb..e4830147fa7 100644
--- a/test/it/parser/src/main/resources/sql/supported/ddl/alter-table.xml
+++ b/test/it/parser/src/main/resources/sql/supported/ddl/alter-table.xml
@@ -158,5 +158,11 @@
<sql-case id="alter_table_drop_expression" value="ALTER TABLE t_order
ALTER COLUMN a DROP EXPRESSION;" db-types="PostgreSQL" />
<sql-case id="alter_table_modify_column_precision_with_decimal"
value="ALTER TABLE t_order MODIFY COLUMN a VARCHAR(10.000000000001)"
db-types="MySQL" />
<sql-case id="alter_table_order_by" value="ALTER TABLE t_order ORDER BY
t_order.id, t_order.status desc" db-types="MySQL" />
- <sql-case id="alter_table_add_supplemental_log_group" value="ALTER TABLE
HR.EMPLOYEES ADD SUPPLEMENTAL LOG GROUP emp_fulltime (EMPLOYEE_ID, LAST_NAME,
DEPARTMENT_ID)" db-types="Oracle" />
+ <sql-case id="alter_table_add_supplemental_log_group1" value="ALTER TABLE
HR.EMPLOYEES ADD SUPPLEMENTAL LOG GROUP emp_fulltime (EMPLOYEE_ID, LAST_NAME,
DEPARTMENT_ID)" db-types="Oracle" />
+ <sql-case id="alter_table_add_supplemental_log_group2" value="ALTER TABLE
HR.EMPLOYEES ADD SUPPLEMENTAL LOG GROUP emp_parttime (EMPLOYEE_ID, LAST_NAME,
DEPARTMENT_ID) ALWAYS" db-types="Oracle" />
+ <sql-case id="alter_table_add_supplemental_log_group3" value="ALTER TABLE
HR.EMPLOYEES ADD SUPPLEMENTAL LOG GROUP emp_parttime(DEPARTMENT_ID NO LOG,
EMPLOYEE_ID)" db-types="Oracle" />
+ <sql-case id="alter_table_add_supplemental_log_data1" value="ALTER TABLE
HR.EMPLOYEES ADD SUPPLEMENTAL LOG DATA (PRIMARY KEY) COLUMNS" db-types="Oracle"
/>
+ <sql-case id="alter_table_add_supplemental_log_data2" value="ALTER TABLE
HR.EMPLOYEES ADD SUPPLEMENTAL LOG DATA (UNIQUE) COLUMNS" db-types="Oracle" />
+ <sql-case id="alter_table_add_supplemental_log_data3" value="ALTER TABLE
HR.EMPLOYEES ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS" db-types="Oracle" />
+ <sql-case id="alter_table_move" value="ALTER TABLE admin_docindex MOVE"
db-types="Oracle" />
</sql-cases>