Changelog: Test that alter view rename column works

Changelog entry in PG13:
Add ALTER VIEW syntax to rename view columns (Fujii Masao)
pull/3900/head
Sait Talha Nisanci 2020-06-19 14:37:45 +03:00
parent 920d7211e4
commit 275ccd0400
2 changed files with 23 additions and 5 deletions

View File

@ -42,13 +42,13 @@ NOTICE: issuing SELECT worker_apply_shard_ddl_command (65002, 'test_pg13', 'CRE
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'
NOTICE: issuing PREPARE TRANSACTION 'citus_0_18072_182_2'
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE: issuing PREPARE TRANSACTION 'citus_0_13977_182_3'
NOTICE: issuing PREPARE TRANSACTION 'citus_0_18072_182_3'
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE: issuing COMMIT PREPARED 'citus_0_13977_182_2'
NOTICE: issuing COMMIT PREPARED 'citus_0_18072_182_2'
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE: issuing COMMIT PREPARED 'citus_0_13977_182_3'
NOTICE: issuing COMMIT PREPARED 'citus_0_18072_182_3'
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
create_distributed_table
---------------------------------------------------------------------
@ -62,8 +62,21 @@ DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
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.
-- alter view rename column works fine
CREATE VIEW v AS SELECT * FROM dist_table;
ALTER VIEW v RENAME age to new_age;
SELECT * FROM v;
NOTICE: issuing SELECT name, age AS new_age FROM test_pg13.dist_table_65000 dist_table WHERE true
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE: issuing SELECT name, age AS new_age FROM test_pg13.dist_table_65001 dist_table WHERE true
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
name | new_age
---------------------------------------------------------------------
(0 rows)
RESET citus.log_remote_commands;
drop schema test_pg13 cascade;
NOTICE: drop cascades to 2 other objects
NOTICE: drop cascades to 3 other objects
DETAIL: drop cascades to table dist_table
drop cascades to table generated_col_table
drop cascades to view v

View File

@ -30,6 +30,11 @@ INSERT INTO generated_col_table VALUES (1);
-- Make sure that we currently error out
ALTER TABLE generated_col_table ALTER COLUMN b DROP EXPRESSION;
-- alter view rename column works fine
CREATE VIEW v AS SELECT * FROM dist_table;
ALTER VIEW v RENAME age to new_age;
SELECT * FROM v;
RESET citus.log_remote_commands;
drop schema test_pg13 cascade;