From 1f8ff61d92b97e168f8c418d2833be92fa68a9a1 Mon Sep 17 00:00:00 2001 From: "Hou Zhijie" Date: Mon, 25 Jul 2022 11:30:18 +0800 Subject: [PATCH] Add support for some missed commands in test_ddl_deparse --- .../test_ddl_deparse/expected/alter_table.out | 25 +++++++++++++++++++ .../test_ddl_deparse/sql/alter_table.sql | 12 +++++++++ .../test_ddl_deparse/test_ddl_deparse.c | 12 +++++++++ 3 files changed, 49 insertions(+) diff --git a/src/test/modules/test_ddl_deparse/expected/alter_table.out b/src/test/modules/test_ddl_deparse/expected/alter_table.out index ec22d688b1..a2a4fcc0bc 100644 --- a/src/test/modules/test_ddl_deparse/expected/alter_table.out +++ b/src/test/modules/test_ddl_deparse/expected/alter_table.out @@ -36,3 +36,28 @@ NOTICE: DDL test: type alter table, tag ALTER TABLE NOTICE: subcommand: type SET NOT NULL desc column a of table part NOTICE: subcommand: type SET NOT NULL desc column a of table part1 NOTICE: subcommand: type ADD INDEX desc index part_pkey +ALTER TABLE parent ALTER COLUMN a SET NOT NULL; +NOTICE: DDL test: type alter table, tag ALTER TABLE +NOTICE: subcommand: type SET NOT NULL desc column a of table parent +NOTICE: subcommand: type SET NOT NULL desc column a of table child +NOTICE: subcommand: type SET NOT NULL desc column a of table grandchild +ALTER TABLE parent ALTER COLUMN a ADD GENERATED ALWAYS AS IDENTITY; +NOTICE: DDL test: type simple, tag CREATE SEQUENCE +NOTICE: DDL test: type simple, tag ALTER SEQUENCE +NOTICE: DDL test: type alter table, tag ALTER TABLE +NOTICE: subcommand: type ADD IDENTITY desc column a of table parent +ALTER TABLE parent ALTER COLUMN a SET GENERATED BY DEFAULT; +NOTICE: DDL test: type simple, tag ALTER SEQUENCE +NOTICE: DDL test: type alter table, tag ALTER TABLE +NOTICE: subcommand: type SET IDENTITY desc column a of table parent +ALTER TABLE parent ALTER COLUMN a DROP IDENTITY; +NOTICE: DDL test: type alter table, tag ALTER TABLE +NOTICE: subcommand: type DROP IDENTITY desc column a of table parent +CREATE STATISTICS parent_stat (dependencies) ON a, c FROM parent; +NOTICE: DDL test: type simple, tag CREATE STATISTICS +ALTER TABLE parent ALTER COLUMN c TYPE numeric; +NOTICE: DDL test: type alter table, tag ALTER TABLE +NOTICE: subcommand: type ALTER COLUMN SET TYPE desc column c of table parent +NOTICE: subcommand: type ALTER COLUMN SET TYPE desc column c of table child +NOTICE: subcommand: type ALTER COLUMN SET TYPE desc column c of table grandchild +NOTICE: subcommand: type (re) ADD STATS desc statistics object parent_stat diff --git a/src/test/modules/test_ddl_deparse/sql/alter_table.sql b/src/test/modules/test_ddl_deparse/sql/alter_table.sql index b0989570d5..f663347cc1 100644 --- a/src/test/modules/test_ddl_deparse/sql/alter_table.sql +++ b/src/test/modules/test_ddl_deparse/sql/alter_table.sql @@ -24,3 +24,15 @@ ALTER TABLE part DETACH PARTITION part2; DROP TABLE part2; ALTER TABLE part ADD PRIMARY KEY (a); + +ALTER TABLE parent ALTER COLUMN a SET NOT NULL; + +ALTER TABLE parent ALTER COLUMN a ADD GENERATED ALWAYS AS IDENTITY; + +ALTER TABLE parent ALTER COLUMN a SET GENERATED BY DEFAULT; + +ALTER TABLE parent ALTER COLUMN a DROP IDENTITY; + +CREATE STATISTICS parent_stat (dependencies) ON a, c FROM parent; + +ALTER TABLE parent ALTER COLUMN c TYPE numeric; diff --git a/src/test/modules/test_ddl_deparse/test_ddl_deparse.c b/src/test/modules/test_ddl_deparse/test_ddl_deparse.c index 4476c8a90e..2296410388 100644 --- a/src/test/modules/test_ddl_deparse/test_ddl_deparse.c +++ b/src/test/modules/test_ddl_deparse/test_ddl_deparse.c @@ -300,6 +300,18 @@ get_altertable_subcmdinfo(PG_FUNCTION_ARGS) case AT_DetachPartitionFinalize: strtype = "DETACH PARTITION ... FINALIZE"; break; + case AT_AddIdentity: + strtype = "ADD IDENTITY"; + break; + case AT_SetIdentity: + strtype = "SET IDENTITY"; + break; + case AT_DropIdentity: + strtype = "DROP IDENTITY"; + break; + case AT_ReAddStatistics: + strtype = "(re) ADD STATS"; + break; default: strtype = "unrecognized"; break; -- 2.18.4