Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add oracle alter table modifylobStorageClause parse rule #28628

Merged
merged 1 commit into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ dropSynonym
;

columnClauses
: operateColumnClause+ | renameColumnClause | modifyCollectionRetrieval
: operateColumnClause+ | renameColumnClause | modifyCollectionRetrieval | modifylobStorageClause
;

operateColumnClause
Expand Down
27 changes: 12 additions & 15 deletions test/it/parser/src/main/resources/case/ddl/alter-table.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@

<alter-table sql-case-id="alter_table_modify_lob_shrink_space">
<table name="employees" start-index="12" stop-index="20" />
<modify-column>
<column-definition start-index="29" stop-index="31">
<column name="LOB" />
</column-definition>
</modify-column>
</alter-table>

<alter-table sql-case-id="alter_table_set_unused">
Expand All @@ -72,11 +67,6 @@

<alter-table sql-case-id="alter_table_modify_lob_cache">
<table name="employees" start-index="12" stop-index="20" />
<modify-column>
<column-definition start-index="29" stop-index="31">
<column name="LOB" />
</column-definition>
</modify-column>
</alter-table>

<alter-table sql-case-id="alter_table_move_storage_tablespace">
Expand Down Expand Up @@ -1600,11 +1590,6 @@

<alter-table sql-case-id="alter_table_modify_lob_nocache">
<table name="employees" start-index="12" stop-index="20" />
<modify-column>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove modify-column?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Define incorrect use cases, and these SQL statements should be parsed by this syntax rule
Ref: https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/ALTER-TABLE.html#GUID-552E7373-BF93-477D-9DA3-B2C9386F2877__I2104157

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Define incorrect use cases, and these SQL statements should be parsed by this syntax rule Ref: https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/ALTER-TABLE.html#GUID-552E7373-BF93-477D-9DA3-B2C9386F2877__I2104157

Got it, thank you.

<column-definition start-index="29" stop-index="31">
<column name="LOB" />
</column-definition>
</modify-column>
</alter-table>

<alter-table sql-case-id="alter_table_move_tablespace1">
Expand Down Expand Up @@ -1712,4 +1697,16 @@
</column-definition>
</add-column>
</alter-table>

<alter-table sql-case-id="alter_table_modify_lob1">
<table name="t1" start-index="12" stop-index="13" />
</alter-table>

<alter-table sql-case-id="alter_table_modify_lob2">
<table name="t1" start-index="12" stop-index="13" />
</alter-table>

<alter-table sql-case-id="alter_table_move_compress_for_oltp">
<table name="table_name" start-index="12" stop-index="21" />
</alter-table>
</sql-parser-test-cases>
Original file line number Diff line number Diff line change
Expand Up @@ -228,4 +228,7 @@
<sql-case id="alter_table_add_ref_with_rowid" value="ALTER TABLE staff ADD (REF(dept) WITH ROWID)" db-types="Oracle" />
<sql-case id="alter_table_add_scope_for_is" value="ALTER TABLE staff ADD (SCOPE FOR (dept) IS offices)" db-types="Oracle" />
<sql-case id="alter_table_add_column_no_parentheses" value="ALTER TABLE T_MASK ADD new_column VARCHAR2(100)" db-types="Oracle" />
<sql-case id="alter_table_modify_lob1" value="ALTER TABLE t1 MODIFY LOB(a) (KEEP_DUPLICATES)" db-types="Oracle" />
<sql-case id="alter_table_modify_lob2" value="ALTER TABLE t1 MODIFY LOB(a) (COMPRESS LOW)" db-types="Oracle" />
<sql-case id="alter_table_move_compress_for_oltp" value="ALTER TABLE table_name MOVE COMPRESS FOR OLTP" db-types="Oracle" />
</sql-cases>