2023-05-17 10:00:35 +08:00
|
|
|
-- Refer: https://github.com/apache/flink/blob/master/flink-table/flink-sql-parser/src/test/java/org/apache/flink/sql/parser/FlinkSqlParserImplTest.java#L2016
|
|
|
|
-- Just for simple alter table statements, it not include alter table columns statements
|
|
|
|
|
2023-05-19 14:28:25 +08:00
|
|
|
ALTER TABLE
|
|
|
|
t1 RENAME TO t2;
|
2023-05-17 10:00:35 +08:00
|
|
|
|
2023-05-19 14:28:25 +08:00
|
|
|
ALTER TABLE
|
|
|
|
IF EXISTS t1 RENAME TO t2;
|
2023-05-17 10:00:35 +08:00
|
|
|
|
2023-05-19 14:28:25 +08:00
|
|
|
ALTER TABLE
|
|
|
|
c1.d1.t1 RENAME TO t2;
|
2023-05-17 10:00:35 +08:00
|
|
|
|
2023-05-19 14:28:25 +08:00
|
|
|
ALTER TABLE
|
|
|
|
IF EXISTS c1.d1.t1 RENAME TO t2;
|
2023-05-17 10:00:35 +08:00
|
|
|
|
2023-05-19 14:28:25 +08:00
|
|
|
ALTER TABLE
|
|
|
|
t1 RENAME a TO b;
|
2023-05-17 10:00:35 +08:00
|
|
|
|
2023-05-19 14:28:25 +08:00
|
|
|
ALTER TABLE
|
|
|
|
IF EXISTS t1 RENAME a TO b;
|
2023-05-17 10:00:35 +08:00
|
|
|
|
2023-05-19 14:28:25 +08:00
|
|
|
ALTER TABLE
|
|
|
|
IF EXISTS t1 RENAME a.x TO a.y;
|
2023-05-17 10:00:35 +08:00
|
|
|
|
2023-05-19 14:28:25 +08:00
|
|
|
ALTER TABLE
|
2023-05-17 10:00:35 +08:00
|
|
|
t1
|
|
|
|
set
|
|
|
|
('key1' = 'value1');
|
|
|
|
|
2023-05-19 14:28:25 +08:00
|
|
|
ALTER TABLE
|
|
|
|
IF EXISTS t1
|
2023-05-17 10:00:35 +08:00
|
|
|
set
|
|
|
|
('key1' = 'value1');
|
|
|
|
|
2023-05-19 14:28:25 +08:00
|
|
|
ALTER TABLE
|
2023-05-17 10:00:35 +08:00
|
|
|
t1
|
2023-05-19 14:28:25 +08:00
|
|
|
ADD
|
|
|
|
CONSTRAINT ct1 PRIMARY KEY(a, b);
|
2023-05-17 10:00:35 +08:00
|
|
|
|
2023-05-19 14:28:25 +08:00
|
|
|
ALTER TABLE
|
2023-05-17 10:00:35 +08:00
|
|
|
t1
|
2023-05-19 14:28:25 +08:00
|
|
|
ADD
|
|
|
|
CONSTRAINT ct1 PRIMARY KEY(a, b) NOT ENFORCED;
|
2023-05-17 10:00:35 +08:00
|
|
|
|
2023-05-19 14:28:25 +08:00
|
|
|
ALTER TABLE
|
|
|
|
IF EXISTS t1
|
|
|
|
ADD
|
|
|
|
CONSTRAINT ct1 PRIMARY KEY(a, b) NOT ENFORCED;
|
2023-05-17 10:00:35 +08:00
|
|
|
|
2023-05-19 14:28:25 +08:00
|
|
|
ALTER TABLE
|
2023-05-17 10:00:35 +08:00
|
|
|
t1
|
2023-05-19 14:28:25 +08:00
|
|
|
ADD
|
|
|
|
UNIQUE(a, b);
|
2023-05-17 10:00:35 +08:00
|
|
|
|
2023-05-19 14:28:25 +08:00
|
|
|
ALTER TABLE
|
|
|
|
IF EXISTS t1
|
|
|
|
ADD
|
|
|
|
UNIQUE(a, b);
|
2023-05-17 10:00:35 +08:00
|
|
|
|
2023-05-19 14:28:25 +08:00
|
|
|
ALTER TABLE
|
|
|
|
t1 DROP CONSTRAINT ct1;
|
2023-05-17 10:00:35 +08:00
|
|
|
|
2023-05-19 14:28:25 +08:00
|
|
|
ALTER TABLE
|
|
|
|
IF EXISTS t1 DROP CONSTRAINT ct1;
|
2023-05-11 18:54:56 +08:00
|
|
|
|