From 275ccd0400d0caba69e85fe0ff619861f5262e48 Mon Sep 17 00:00:00 2001 From: Sait Talha Nisanci Date: Fri, 19 Jun 2020 14:37:45 +0300 Subject: [PATCH] Changelog: Test that alter view rename column works Changelog entry in PG13: Add ALTER VIEW syntax to rename view columns (Fujii Masao) --- src/test/regress/expected/pg13.out | 23 ++++++++++++++++++----- src/test/regress/sql/pg13.sql | 5 +++++ 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/test/regress/expected/pg13.out b/src/test/regress/expected/pg13.out index 3b72db614..a8b3bcd85 100644 --- a/src/test/regress/expected/pg13.out +++ b/src/test/regress/expected/pg13.out @@ -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 diff --git a/src/test/regress/sql/pg13.sql b/src/test/regress/sql/pg13.sql index e34490926..bf9d6b1e6 100644 --- a/src/test/regress/sql/pg13.sql +++ b/src/test/regress/sql/pg13.sql @@ -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; \ No newline at end of file