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 913bf932311 Improve Oracle alter Table Properties syntax (#28020)
913bf932311 is described below

commit 913bf932311d03471b28930b5a8423e0f8fb6b42
Author: niu niu <[email protected]>
AuthorDate: Sat Aug 12 15:06:06 2023 +0800

    Improve Oracle alter Table Properties syntax (#28020)
---
 .../src/main/antlr4/imports/oracle/DDLStatement.g4 | 43 +++++++++++++++++++++-
 .../src/main/resources/case/ddl/alter-table.xml    | 20 ++++++++++
 .../resources/sql/supported/ddl/alter-table.xml    |  4 ++
 3 files changed, 65 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 42146a3ca46..19460bff9e9 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
@@ -413,7 +413,30 @@ alterDefinitionClause
     ;
 
 alterTableProperties
-    : renameTableSpecification | REKEY encryptionSpecification | 
supplementalTableLogging
+    : ((physicalAttributesClause
+    | loggingClause
+    | tableCompression
+    | inmemoryTableClause
+    | ilmClause
+    | supplementalTableLogging
+    | allocateExtentClause
+    | deallocateUnusedClause
+    | (CACHE | NOCACHE)
+    | upgradeTableClause
+    | recordsPerBlockClause
+    | parallelClause
+    | rowMovementClause
+    | logicalReplicationClause
+    | flashbackArchiveClause)+ | renameTableSpecification) alterIotClauses? 
alterXMLSchemaClause?
+    | shrinkClause
+    | READ ONLY
+    | READ WRITE
+    | REKEY encryptionSpecification
+    | DEFAULT COLLATION collationName
+    | NO? ROW ARCHIVAL
+    | ADD attributeClusteringClause
+    | MODIFY CLUSTERING clusteringWhen? zonemapClause?
+    | DROP CLUSTERING
     ;
 
 renameTableSpecification
@@ -1193,6 +1216,10 @@ rowMovementClause
     : (ENABLE | DISABLE) ROW MOVEMENT
     ;
 
+logicalReplicationClause
+    : (ENABLE | DISABLE) LOGICAL REPLICATION
+    ;
+
 flashbackArchiveClause
     : FLASHBACK ARCHIVE flashbackArchiveName? | NO FLASHBACK ARCHIVE
     ;
@@ -1336,6 +1363,14 @@ partitionSpec
     : PARTITION partitionName? tablePartitionDescription?
     ;
 
+upgradeTableClause
+    : UPGRADE (NOT? INCLUDING DATA)? columnProperties?
+    ;
+
+recordsPerBlockClause
+    : (MINIMIZE | NOMINIMIZE) RECORDS_PER_BLOCK
+    ;
+
 partitionAttributes
     : (physicalAttributesClause | loggingClause | allocateExtentClause | 
deallocateUnusedClause | shrinkClause)*
       (OVERFLOW (physicalAttributesClause | loggingClause | 
allocateExtentClause | deallocateUnusedClause)*)?
@@ -3322,12 +3357,16 @@ modifylobParameters
     | deallocateUnusedClause
     ;
 
- alterIotClauses
+alterIotClauses
     : indexOrgTableClause
     | alterOverflowClause
     | COALESCE
     ;
 
+alterXMLSchemaClause
+    : ALLOW (ANYSCHEMA | NONSCHEMA) | DISALLOW NONSCHEMA
+    ;
+
 alterOverflowClause
     : addOverflowClause | overflowClause
     ;
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 b32d7496a4c..ebbbf5557be 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
@@ -17,6 +17,26 @@
   -->
 
 <sql-parser-test-cases>
+    <alter-table sql-case-id="alter_table_move_tablespace_overflow_tablespace">
+        <table name="admin_docindex" start-index="12" stop-index="25" />
+    </alter-table>
+    
+    <alter-table sql-case-id="alter_table_move_nocompress">
+        <table name="admin_iot5" start-index="12" stop-index="21" />
+    </alter-table>
+    
+    <alter-table sql-case-id="alter_table_enable_row_movement">
+        <table name="AUD$" start-index="12" stop-index="22">
+            <owner start-index="12" stop-index="17" name="SYSTEM" />
+        </table>
+    </alter-table>
+    
+    <alter-table sql-case-id="alter_table_shrink_space_cascade">
+        <table name="AUD$" start-index="12" stop-index="22">
+            <owner start-index="12" stop-index="17" name="SYSTEM" />
+        </table>
+    </alter-table>
+    
     <alter-table sql-case-id="alter_table">
         <table name="t_log" start-index="12" stop-index="16" />
         <add-column>
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 13e1b90df55..053f200cd84 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
@@ -17,6 +17,10 @@
   -->
 
 <sql-cases>
+    <sql-case id="alter_table_move_tablespace_overflow_tablespace" 
value="ALTER TABLE admin_docindex MOVE TABLESPACE admin_tbs2 OVERFLOW 
TABLESPACE admin_tbs3" db-types="Oracle" />
+    <sql-case id="alter_table_move_nocompress" value="ALTER TABLE admin_iot5 
MOVE NOCOMPRESS" db-types="Oracle" />
+    <sql-case id="alter_table_enable_row_movement" value="ALTER TABLE 
SYSTEM.AUD$ ENABLE ROW MOVEMENT" db-types="Oracle" />
+    <sql-case id="alter_table_shrink_space_cascade" value="ALTER TABLE 
SYSTEM.AUD$ SHRINK SPACE CASCADE" db-types="Oracle" />
     <sql-case id="alter_table" value="ALTER TABLE t_log ADD name varchar(10)" 
db-types="MySQL, PostgreSQL,openGauss" />
     <sql-case id="alter_table_oracle" value="ALTER TABLE t_log ADD (name 
varchar(10))" db-types="Oracle" />
     <sql-case id="alter_table_not_null" value="alter table t1 add c2 real  not 
null" db-types="MySQL" />

Reply via email to