From 920d7211e4c847866c63e8e6c247bbb31753197e Mon Sep 17 00:00:00 2001 From: Sait Talha Nisanci Date: Fri, 19 Jun 2020 14:03:45 +0300 Subject: [PATCH] Changelog: Test that we error out for DROP EXPRESSION PG13 now supports dropping expression from a column such as generated columns. We error out with this currently. Changelog entry in postgres: Add ALTER TABLE clause DROP EXPRESSION to remove generated properties from columns (Peter Eisentraut) --- src/test/regress/expected/pg13.out | 35 +++++++++++++++++++++++++++++- src/test/regress/sql/pg13.sql | 8 +++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/src/test/regress/expected/pg13.out b/src/test/regress/expected/pg13.out index 860ed3a20..3b72db614 100644 --- a/src/test/regress/expected/pg13.out +++ b/src/test/regress/expected/pg13.out @@ -31,6 +31,39 @@ ERROR: parallel vacuum degree must be between 0 and 1024 VACUUM (PARALLEL) dist_table; ERROR: parallel option requires a value between 0 and 1024 RESET client_min_messages; +-- test alter table alter column drop expression +CREATE TABLE generated_col_table(a int, b int GENERATED ALWAYS AS (a * 10) STORED); +SELECT create_distributed_table('generated_col_table', 'a'); +NOTICE: issuing BEGIN TRANSACTION ISOLATION LEVEL READ COMMITTED;SELECT assign_distributed_transaction_id(xx, xx, 'xxxxxxx'); +DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx +NOTICE: issuing BEGIN TRANSACTION ISOLATION LEVEL READ COMMITTED;SELECT assign_distributed_transaction_id(xx, xx, 'xxxxxxx'); +DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx +NOTICE: issuing SELECT worker_apply_shard_ddl_command (65002, 'test_pg13', 'CREATE TABLE test_pg13.generated_col_table (a integer, b integer GENERATED ALWAYS AS ((a * 10)) STORED)');SELECT worker_apply_shard_ddl_command (65002, 'test_pg13', 'ALTER TABLE test_pg13.generated_col_table OWNER TO postgres') +DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx +NOTICE: issuing SELECT worker_apply_shard_ddl_command (65003, 'test_pg13', 'CREATE TABLE test_pg13.generated_col_table (a integer, b integer GENERATED ALWAYS AS ((a * 10)) STORED)');SELECT worker_apply_shard_ddl_command (65003, 'test_pg13', 'ALTER TABLE test_pg13.generated_col_table OWNER TO postgres') +DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx +NOTICE: issuing PREPARE TRANSACTION 'citus_0_13977_182_2' +DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx +NOTICE: issuing PREPARE TRANSACTION 'citus_0_13977_182_3' +DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx +NOTICE: issuing COMMIT PREPARED 'citus_0_13977_182_2' +DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx +NOTICE: issuing COMMIT PREPARED 'citus_0_13977_182_3' +DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx + create_distributed_table +--------------------------------------------------------------------- + +(1 row) + +INSERT INTO generated_col_table VALUES (1); +NOTICE: issuing INSERT INTO test_pg13.generated_col_table_65002 (a) VALUES (1) +DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx +-- Make sure that we currently error out +ALTER TABLE generated_col_table ALTER COLUMN b DROP EXPRESSION; +ERROR: alter table command is currently unsupported +DETAIL: Only ADD|DROP COLUMN, SET|DROP NOT NULL, SET|DROP DEFAULT, ADD|DROP|VALIDATE CONSTRAINT, SET (), RESET (), ATTACH|DETACH PARTITION and TYPE subcommands are supported. RESET citus.log_remote_commands; drop schema test_pg13 cascade; -NOTICE: drop cascades to table dist_table +NOTICE: drop cascades to 2 other objects +DETAIL: drop cascades to table dist_table +drop cascades to table generated_col_table diff --git a/src/test/regress/sql/pg13.sql b/src/test/regress/sql/pg13.sql index 2b75b8b4e..e34490926 100644 --- a/src/test/regress/sql/pg13.sql +++ b/src/test/regress/sql/pg13.sql @@ -22,6 +22,14 @@ VACUUM (PARALLEL -5) dist_table; VACUUM (PARALLEL) dist_table; RESET client_min_messages; + +-- test alter table alter column drop expression +CREATE TABLE generated_col_table(a int, b int GENERATED ALWAYS AS (a * 10) STORED); +SELECT create_distributed_table('generated_col_table', 'a'); +INSERT INTO generated_col_table VALUES (1); +-- Make sure that we currently error out +ALTER TABLE generated_col_table ALTER COLUMN b DROP EXPRESSION; + RESET citus.log_remote_commands; drop schema test_pg13 cascade; \ No newline at end of file