DBZ-7506 Support Oracle 23 Annotations on CREATE/ALTER TABLE

This commit is contained in:
Chris Cranford 2024-02-18 14:28:39 -05:00 committed by Jiri Pechanec
parent df0f749a37
commit 69824dc8ed
4 changed files with 49 additions and 4 deletions

View File

@ -79,6 +79,7 @@ ANALYZE: 'ANALYZE';
ANCILLARY: 'ANCILLARY'; ANCILLARY: 'ANCILLARY';
AND: 'AND'; AND: 'AND';
AND_EQUAL: 'AND_EQUAL'; AND_EQUAL: 'AND_EQUAL';
ANNOTATIONS: 'ANNOTATIONS';
ANOMALY: 'ANOMALY'; ANOMALY: 'ANOMALY';
ANSI_REARCH: 'ANSI_REARCH'; ANSI_REARCH: 'ANSI_REARCH';
ANTIJOIN: 'ANTIJOIN'; ANTIJOIN: 'ANTIJOIN';

View File

@ -1843,7 +1843,7 @@ xmltype_table
physical_properties? column_properties? table_partitioning_clauses? physical_properties? column_properties? table_partitioning_clauses?
(CACHE | NOCACHE)? (RESULT_CACHE '(' MODE (DEFAULT | FORCE) ')')? (CACHE | NOCACHE)? (RESULT_CACHE '(' MODE (DEFAULT | FORCE) ')')?
parallel_clause? (ROWDEPENDENCIES | NOROWDEPENDENCIES)? parallel_clause? (ROWDEPENDENCIES | NOROWDEPENDENCIES)?
(enable_disable_clause+)? row_movement_clause? logical_replication_clause? flashback_archive_clause? (enable_disable_clause+)? row_movement_clause? logical_replication_clause? flashback_archive_clause? annotations_clause?
; ;
xmltype_virtual_columns xmltype_virtual_columns
@ -1874,7 +1874,7 @@ object_table
physical_properties? column_properties? table_partitioning_clauses? physical_properties? column_properties? table_partitioning_clauses?
(CACHE | NOCACHE)? (RESULT_CACHE '(' MODE (DEFAULT | FORCE) ')')? (CACHE | NOCACHE)? (RESULT_CACHE '(' MODE (DEFAULT | FORCE) ')')?
parallel_clause? (ROWDEPENDENCIES | NOROWDEPENDENCIES)? parallel_clause? (ROWDEPENDENCIES | NOROWDEPENDENCIES)?
(enable_disable_clause+)? row_movement_clause? logical_replication_clause? flashback_archive_clause? (enable_disable_clause+)? row_movement_clause? logical_replication_clause? flashback_archive_clause? annotations_clause?
; ;
oid_index_clause oid_index_clause
@ -1906,7 +1906,7 @@ relational_table
(CACHE | NOCACHE)? (RESULT_CACHE '(' MODE (DEFAULT | FORCE) ')')? (CACHE | NOCACHE)? (RESULT_CACHE '(' MODE (DEFAULT | FORCE) ')')?
parallel_clause? parallel_clause?
(ROWDEPENDENCIES | NOROWDEPENDENCIES)? (ROWDEPENDENCIES | NOROWDEPENDENCIES)?
(enable_disable_clause+)? row_movement_clause? logical_replication_clause? flashback_archive_clause? (enable_disable_clause+)? row_movement_clause? logical_replication_clause? flashback_archive_clause? annotations_clause?
; ;
relational_property relational_property
@ -2946,6 +2946,7 @@ alter_table_properties
| READ ONLY | READ ONLY
| READ WRITE | READ WRITE
| REKEY CHAR_STRING | REKEY CHAR_STRING
| annotations_clause?
; ;
alter_table_properties_1 alter_table_properties_1
@ -3193,7 +3194,7 @@ modify_column_clauses
; ;
modify_col_properties modify_col_properties
: column_name datatype? (DEFAULT column_default_value)? (ENCRYPT encryption_spec | DECRYPT)? inline_constraint* lob_storage_clause? //TODO alter_xmlschema_clause : column_name datatype? (DEFAULT column_default_value)? (ENCRYPT encryption_spec | DECRYPT)? inline_constraint* lob_storage_clause? annotations_clause? //TODO alter_xmlschema_clause
; ;
modify_col_visibility modify_col_visibility
@ -3340,6 +3341,7 @@ column_definition
(VISIBLE | INVISIBLE)? (VISIBLE | INVISIBLE)?
(DEFAULT (ON NULL_)? column_default_value | identity_clause)? (DEFAULT (ON NULL_)? column_default_value | identity_clause)?
(ENCRYPT (USING CHAR_STRING)? (IDENTIFIED BY regular_id)? CHAR_STRING? (NO? SALT)? )? (inline_constraint* | inline_ref_constraint) (ENCRYPT (USING CHAR_STRING)? (IDENTIFIED BY regular_id)? CHAR_STRING? (NO? SALT)? )? (inline_constraint* | inline_ref_constraint)
annotations_clause?
; ;
column_default_value column_default_value
@ -3354,6 +3356,29 @@ virtual_column_definition
VIRTUAL? evaluation_edition_clause? unusable_editions_clause? inline_constraint* VIRTUAL? evaluation_edition_clause? unusable_editions_clause? inline_constraint*
; ;
annotations_clause
: ANNOTATIONS '(' annotations_list ')'
;
annotations_list
: ADD (IF NOT EXISTS | OR REPLACE)? annotation (',' annotations_list)*
| DROP (IF EXISTS)? annotation (',' annotations_list)*
| REPLACE annotation (',' annotations_list)*
| annotation (',' annotations_list)*
;
annotation
: annotation_name annotation_value?
;
annotation_name
: identifier
;
annotation_value
: CHAR_STRING
;
identity_clause identity_clause
: GENERATED (ALWAYS | BY DEFAULT (ON NULL_)?)? AS IDENTITY ( '('? (sequence_start_clause | sequence_spec)* ')'? )? : GENERATED (ALWAYS | BY DEFAULT (ON NULL_)?)? AS IDENTITY ( '('? (sequence_start_clause | sequence_spec)* ')'? )?
; ;

View File

@ -77,3 +77,11 @@ ALTER TABLE TABLE_NAME
SPLIT PARTITION TABLE_NAME_CURRENT AT (TO_DATE('20240116040241', 'YYYYMMDDHH24MISS')) SPLIT PARTITION TABLE_NAME_CURRENT AT (TO_DATE('20240116040241', 'YYYYMMDDHH24MISS'))
INTO (PARTITION TABLE_NAME_20240116040241, PARTITION TABLE_NAME_CURRENT) INTO (PARTITION TABLE_NAME_20240116040241, PARTITION TABLE_NAME_CURRENT)
UPDATE INDEXES (COST_IX (PARTITION C_P1 TABLESPACE TBS_02, PARTITION C_P2 TABLESPACE TBS_03)); UPDATE INDEXES (COST_IX (PARTITION C_P1 TABLESPACE TBS_02, PARTITION C_P2 TABLESPACE TBS_03));
-- alter table (Oracle 23+)
alter table fruit annotations (Visibility 'Everyone');
alter table fruit annotations (drop Visibility);
alter table fruit annotations (add Visibility 'Everyone');
alter table fruit modify (id annotations (Visibility 'Hidden'));
alter table fruit modify (id annotations (drop Visibility));
alter table fruit modify (id annotations (add Visibility 'Hidden'));

View File

@ -658,6 +658,17 @@ CREATE IMMUTABLE BLOCKCHAIN TABLE t_temp_log(id int, status varchar(10));
-- Create table (Oracle 23+) -- Create table (Oracle 23+)
create table debezium.products if not exists (id NUMBER(4) GENERATED BY DEFAULT ON NULL AS IDENTITY (START WITH 101) NOT NULL PRIMARY KEY, name VARCHAR2(255) NOT NULL, description VARCHAR2(512), weight FLOAT); create table debezium.products if not exists (id NUMBER(4) GENERATED BY DEFAULT ON NULL AS IDENTITY (START WITH 101) NOT NULL PRIMARY KEY, name VARCHAR2(255) NOT NULL, description VARCHAR2(512), weight FLOAT);
create table debezium.fruits (
id number annotations (SurrogateKey, UI_Display 'Fruit ID', Classification 'Fruit Info'),
name varchar2(50) annotations (UI_Display 'Fruit Name', Classification 'Fruit Info'),
description varchar2(50) annotations (UI_Display 'Description', Classification 'Fruit Info')
);
create table debezium.fruits (
id number annotations (SurrogateKey, UI_Display 'Fruit ID', Classification 'Fruit Info'),
name varchar2(50) annotations (UI_Display 'Fruit Name', Classification 'Fruit Info'),
description varchar2(50) annotations (UI_Display 'Description', Classification 'Fruit Info')
)
annotations (UI_Display 'Fruit Table', Classification 'Fruit Info');
-- Create index (Oracle 23+) -- Create index (Oracle 23+)
create index hr.name IF NOT EXISTS on hr.table (id,data) tablespace ts; create index hr.name IF NOT EXISTS on hr.table (id,data) tablespace ts;
-- Create user (Oracle 23+) -- Create user (Oracle 23+)