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)
pull/3900/head
Sait Talha Nisanci 2020-06-19 14:03:45 +03:00
parent 87088d92bc
commit 920d7211e4
2 changed files with 42 additions and 1 deletions

View File

@ -31,6 +31,39 @@ ERROR: parallel vacuum degree must be between 0 and 1024
VACUUM (PARALLEL) dist_table; VACUUM (PARALLEL) dist_table;
ERROR: parallel option requires a value between 0 and 1024 ERROR: parallel option requires a value between 0 and 1024
RESET client_min_messages; 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; RESET citus.log_remote_commands;
drop schema test_pg13 cascade; 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

View File

@ -22,6 +22,14 @@ VACUUM (PARALLEL -5) dist_table;
VACUUM (PARALLEL) dist_table; VACUUM (PARALLEL) dist_table;
RESET client_min_messages; 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; RESET citus.log_remote_commands;
drop schema test_pg13 cascade; drop schema test_pg13 cascade;