From cc1ff00e8a16075157abe4dbc638a90dd98ec1b2 Mon Sep 17 00:00:00 2001 From: Onur Tirtir Date: Tue, 5 Jan 2021 15:16:53 +0300 Subject: [PATCH] fixup! Update existing tests & Add more tests --- .../multi_foreign_key_relation_graph.out | 17 ++++++++++++++++- .../sql/multi_foreign_key_relation_graph.sql | 6 +++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/test/regress/expected/multi_foreign_key_relation_graph.out b/src/test/regress/expected/multi_foreign_key_relation_graph.out index 09c7c2580..9bda65c72 100644 --- a/src/test/regress/expected/multi_foreign_key_relation_graph.out +++ b/src/test/regress/expected/multi_foreign_key_relation_graph.out @@ -963,10 +963,25 @@ ALTER TABLE partitioned_table_1 ADD CONSTRAINT fkey_8 FOREIGN KEY (col_1) REFERE DEBUG: DDL command invalidates foreign key graph ALTER TABLE partitioned_table_2 ADD CONSTRAINT fkey_9 FOREIGN KEY (col_1) REFERENCES reference_table_4(col_2); DEBUG: DDL command invalidates foreign key graph --- show that we don't invalidate foreign key graph for attach partition commands CREATE TABLE partitioned_table_1_300_400 PARTITION OF partitioned_table_1 FOR VALUES FROM (300) TO (400); DEBUG: CREATE TABLE / UNIQUE will create implicit index "partitioned_table_1_300_400_col_1_key" for table "partitioned_table_1_300_400" DEBUG: switching to sequential query execution mode +-- we invalidate foreign key graph as attach partition creates a new distributed table +SELECT oid::regclass::text AS tablename +FROM get_foreign_key_connected_relations('partitioned_table_1_300_400') AS f(oid oid) +ORDER BY tablename; + tablename +--------------------------------------------------------------------- + partitioned_table_1 + partitioned_table_1_100_200 + partitioned_table_1_200_300 + partitioned_table_1_300_400 + partitioned_table_2 + partitioned_table_2_100_200 + partitioned_table_2_200_300 + reference_table_4 +(8 rows) + set client_min_messages to error; SET search_path TO public; DROP SCHEMA fkey_graph CASCADE; diff --git a/src/test/regress/sql/multi_foreign_key_relation_graph.sql b/src/test/regress/sql/multi_foreign_key_relation_graph.sql index 34e96104a..cb23f8da2 100644 --- a/src/test/regress/sql/multi_foreign_key_relation_graph.sql +++ b/src/test/regress/sql/multi_foreign_key_relation_graph.sql @@ -440,9 +440,13 @@ SELECT create_reference_table('reference_table_4'); ALTER TABLE partitioned_table_1 ADD CONSTRAINT fkey_8 FOREIGN KEY (col_1) REFERENCES reference_table_4(col_2); ALTER TABLE partitioned_table_2 ADD CONSTRAINT fkey_9 FOREIGN KEY (col_1) REFERENCES reference_table_4(col_2); --- show that we don't invalidate foreign key graph for attach partition commands CREATE TABLE partitioned_table_1_300_400 PARTITION OF partitioned_table_1 FOR VALUES FROM (300) TO (400); +-- we invalidate foreign key graph as attach partition creates a new distributed table +SELECT oid::regclass::text AS tablename +FROM get_foreign_key_connected_relations('partitioned_table_1_300_400') AS f(oid oid) +ORDER BY tablename; + set client_min_messages to error; SET search_path TO public;