From: Kyotaro Horiguchi Date: Fri, 9 Jul 2021 20:40:52 +0900 Subject: [PATCH v3 2/2] regress - Add missing targets in ATWrongRelkindError --- src/test/regress/expected/alter_table.out | 4 ++++ src/test/regress/expected/foreign_data.out | 4 +++- src/test/regress/sql/alter_table.sql | 4 ++++ src/test/regress/sql/foreign_data.sql | 3 ++- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/test/regress/expected/alter_table.out b/src/test/regress/expected/alter_table.out index 8d91e2d6c8..5f6d4ed7c3 100644 --- a/src/test/regress/expected/alter_table.out +++ b/src/test/regress/expected/alter_table.out @@ -6,6 +6,7 @@ SET client_min_messages TO 'warning'; DROP ROLE IF EXISTS regress_alter_table_user1; RESET client_min_messages; CREATE USER regress_alter_table_user1; +CREATE VIEW at_v1 AS SELECT 1 as a; -- -- add attribute -- @@ -3948,6 +3949,9 @@ ERROR: remainder for hash partition must be less than modulus ALTER TABLE hash_parted ATTACH PARTITION fail_part FOR VALUES WITH (MODULUS 3, REMAINDER 2); ERROR: every hash partition modulus must be a factor of the next larger modulus DROP TABLE fail_part; +-- check that attach partition correctly complains for the object of a wrong type +ALTER TABLE at_v1 ATTACH PARTITION dummy default; -- ERROR +ERROR: "at_v1" is not a partitioned table or index -- -- DETACH PARTITION -- diff --git a/src/test/regress/expected/foreign_data.out b/src/test/regress/expected/foreign_data.out index b9e25820bc..ffa9287967 100644 --- a/src/test/regress/expected/foreign_data.out +++ b/src/test/regress/expected/foreign_data.out @@ -877,8 +877,10 @@ ERROR: column "no_column" of relation "ft1" does not exist ALTER FOREIGN TABLE ft1 DROP COLUMN IF EXISTS no_column; NOTICE: column "no_column" of relation "ft1" does not exist, skipping ALTER FOREIGN TABLE ft1 DROP COLUMN c9; +ALTER FOREIGN TABLE ft1 SET TABLESPACE ts; -- ERROR (wrong object type) +ERROR: "ft1" is not a table, materialized view, index, or partitioned index ALTER FOREIGN TABLE ft1 SET SCHEMA foreign_schema; -ALTER FOREIGN TABLE ft1 SET TABLESPACE ts; -- ERROR +ALTER FOREIGN TABLE ft1 SET TABLESPACE ts; -- ERROR (not found) ERROR: relation "ft1" does not exist ALTER FOREIGN TABLE foreign_schema.ft1 RENAME c1 TO foreign_column_1; ALTER FOREIGN TABLE foreign_schema.ft1 RENAME TO foreign_table_1; diff --git a/src/test/regress/sql/alter_table.sql b/src/test/regress/sql/alter_table.sql index cd925ea8ce..a92cea7f87 100644 --- a/src/test/regress/sql/alter_table.sql +++ b/src/test/regress/sql/alter_table.sql @@ -8,6 +8,7 @@ DROP ROLE IF EXISTS regress_alter_table_user1; RESET client_min_messages; CREATE USER regress_alter_table_user1; +CREATE VIEW at_v1 AS SELECT 1 as a; -- -- add attribute @@ -2593,6 +2594,9 @@ ALTER TABLE hash_parted ATTACH PARTITION fail_part FOR VALUES WITH (MODULUS 8, R ALTER TABLE hash_parted ATTACH PARTITION fail_part FOR VALUES WITH (MODULUS 3, REMAINDER 2); DROP TABLE fail_part; +-- check that attach partition correctly complains for the object of a wrong type +ALTER TABLE at_v1 ATTACH PARTITION dummy default; -- ERROR + -- -- DETACH PARTITION -- diff --git a/src/test/regress/sql/foreign_data.sql b/src/test/regress/sql/foreign_data.sql index 73f9f621d8..e96aef5396 100644 --- a/src/test/regress/sql/foreign_data.sql +++ b/src/test/regress/sql/foreign_data.sql @@ -406,8 +406,9 @@ ALTER FOREIGN TABLE ft1 OPTIONS (DROP delimiter, SET quote '~', ADD escape '@'); ALTER FOREIGN TABLE ft1 DROP COLUMN no_column; -- ERROR ALTER FOREIGN TABLE ft1 DROP COLUMN IF EXISTS no_column; ALTER FOREIGN TABLE ft1 DROP COLUMN c9; +ALTER FOREIGN TABLE ft1 SET TABLESPACE ts; -- ERROR (wrong object type) ALTER FOREIGN TABLE ft1 SET SCHEMA foreign_schema; -ALTER FOREIGN TABLE ft1 SET TABLESPACE ts; -- ERROR +ALTER FOREIGN TABLE ft1 SET TABLESPACE ts; -- ERROR (not found) ALTER FOREIGN TABLE foreign_schema.ft1 RENAME c1 TO foreign_column_1; ALTER FOREIGN TABLE foreign_schema.ft1 RENAME TO foreign_table_1; \d foreign_schema.foreign_table_1 -- 2.27.0 ----Next_Part(Fri_Jul__9_21_00_31_2021_633)----