You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2026/08/22 06:46:27 UTC
(shardingsphere) branch master updated: Support parsing Oracle PARTITION BY REFERENCE sql (#39548)
This is an automated email from the ASF dual-hosted git repository.
terrymanu 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 32eed4dfded Support parsing Oracle PARTITION BY REFERENCE sql (#39548)
32eed4dfded is described below
commit 32eed4dfdedd430dd0b5b814ce5e9999c2cdc95e
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sat Aug 22 14:46:20 2026 +0800
Support parsing Oracle PARTITION BY REFERENCE sql (#39548)
For #27104
---
.../src/main/antlr4/imports/oracle/DDLStatement.g4 | 2 +-
.../src/main/resources/case/ddl/create-table.xml | 24 +++++++++++++++++++++-
.../resources/sql/supported/ddl/create-table.xml | 10 +++++++++
3 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/parser/sql/engine/dialect/oracle/src/main/antlr4/imports/oracle/DDLStatement.g4 b/parser/sql/engine/dialect/oracle/src/main/antlr4/imports/oracle/DDLStatement.g4
index 4f5f930bca4..95f7616ab2c 100644
--- a/parser/sql/engine/dialect/oracle/src/main/antlr4/imports/oracle/DDLStatement.g4
+++ b/parser/sql/engine/dialect/oracle/src/main/antlr4/imports/oracle/DDLStatement.g4
@@ -1418,7 +1418,7 @@ compositeHashPartitions
;
referencePartitioning
- :PARTITION BY REFERENCE LP_ constraint RP_ (LP_? referencePartitionDesc (COMMA_ referencePartitionDesc)* RP_?)?
+ : PARTITION BY REFERENCE LP_ constraintName RP_ (LP_? referencePartitionDesc (COMMA_ referencePartitionDesc)* RP_?)?
;
referencePartitionDesc
diff --git a/test/it/parser/src/main/resources/case/ddl/create-table.xml b/test/it/parser/src/main/resources/case/ddl/create-table.xml
index 3de6141527a..02f7e5d43a1 100644
--- a/test/it/parser/src/main/resources/case/ddl/create-table.xml
+++ b/test/it/parser/src/main/resources/case/ddl/create-table.xml
@@ -2596,7 +2596,29 @@
<column name="unit_price" start-index="82" stop-index="91" />
</column-definition>
</create-table>
-
+
+ <create-table sql-case-id="create_table_partition_by_reference">
+ <table name="order_items" start-index="13" stop-index="23" />
+ <column-definition type="NUMBER" start-index="31" stop-index="68">
+ <column name="order_id" start-index="31" stop-index="38" />
+ </column-definition>
+ <column-definition type="NUMBER" start-index="77" stop-index="114">
+ <column name="line_item_id" start-index="77" stop-index="88" />
+ </column-definition>
+ <column-definition type="NUMBER" start-index="123" stop-index="160">
+ <column name="product_id" start-index="123" stop-index="132" />
+ </column-definition>
+ <column-definition type="NUMBER" start-index="169" stop-index="198">
+ <column name="unit_price" start-index="169" stop-index="178" />
+ </column-definition>
+ <column-definition type="NUMBER" start-index="207" stop-index="234">
+ <column name="quantity" start-index="207" stop-index="214" />
+ </column-definition>
+ <constraint-definition constraint-name="order_items_fk" start-index="243" stop-index="323">
+ <referenced-table name="orders" start-index="308" stop-index="313" />
+ </constraint-definition>
+ </create-table>
+
<create-table sql-case-id="create_table_default_user">
<table name="audit_trail" start-index="13" stop-index="23" />
<column-definition type="NUMBER" start-index="26" stop-index="38">
diff --git a/test/it/parser/src/main/resources/sql/supported/ddl/create-table.xml b/test/it/parser/src/main/resources/sql/supported/ddl/create-table.xml
index 14505345d9f..f1b8f9d45ef 100644
--- a/test/it/parser/src/main/resources/sql/supported/ddl/create-table.xml
+++ b/test/it/parser/src/main/resources/sql/supported/ddl/create-table.xml
@@ -188,6 +188,16 @@
PARTITION costs_q1_2003 VALUES LESS THAN (TO_DATE('01-APR-2003', 'DD-MON-YYYY')),
PARTITION costs_q2_2003 VALUES LESS THAN (TO_DATE('01-JUN-2003', 'DD-MON-YYYY')),
PARTITION costs_recent VALUES LESS THAN (MAXVALUE))" db-types="Oracle" />
+ <sql-case id="create_table_partition_by_reference" value="CREATE TABLE order_items
+ ( order_id NUMBER(12) NOT NULL,
+ line_item_id NUMBER(3) NOT NULL,
+ product_id NUMBER(6) NOT NULL,
+ unit_price NUMBER(8,2),
+ quantity NUMBER(8),
+ CONSTRAINT order_items_fk
+ FOREIGN KEY(order_id) REFERENCES orders(order_id)
+ )
+ PARTITION BY REFERENCE(order_items_fk)" db-types="Oracle" />
<sql-case id="create_table_default_user" value="CREATE TABLE audit_trail (value1 NUMBER, value2 VARCHAR2(32), inserter VARCHAR2(30) DEFAULT USER)" db-types="Oracle" />
<sql-case id="create_table_partition_by_list_subpartition_by_hash1" value="CREATE TABLE car_rentals
(id NUMBER NOT NULL,