mirror of https://github.com/citusdata/citus.git
fixup! Update existing tests & Add more tests
parent
fc8cc90845
commit
ea5a85bc91
|
@ -982,6 +982,32 @@ ORDER BY tablename;
|
||||||
reference_table_4
|
reference_table_4
|
||||||
(8 rows)
|
(8 rows)
|
||||||
|
|
||||||
|
CREATE TABLE local_partitioned_table_1 (col_1 INT UNIQUE, col_2 INT) PARTITION BY RANGE (col_1);
|
||||||
|
DEBUG: CREATE TABLE / UNIQUE will create implicit index "local_partitioned_table_1_col_1_key" for table "local_partitioned_table_1"
|
||||||
|
CREATE TABLE local_partitioned_table_2 (col_1 INT UNIQUE, col_2 INT) PARTITION BY RANGE (col_1);
|
||||||
|
DEBUG: CREATE TABLE / UNIQUE will create implicit index "local_partitioned_table_2_col_1_key" for table "local_partitioned_table_2"
|
||||||
|
-- in below two show that attaching a partition doesn't invalidate
|
||||||
|
-- foreign key cache as parent table isn't involved in any foreign
|
||||||
|
-- key relationship
|
||||||
|
CREATE TABLE local_partitioned_table_1_100_200 PARTITION OF local_partitioned_table_1 FOR VALUES FROM (100) TO (200);
|
||||||
|
DEBUG: CREATE TABLE / UNIQUE will create implicit index "local_partitioned_table_1_100_200_col_1_key" for table "local_partitioned_table_1_100_200"
|
||||||
|
CREATE TABLE local_partitioned_table_2_100_200 (col_1 INT UNIQUE, col_2 INT);
|
||||||
|
DEBUG: CREATE TABLE / UNIQUE will create implicit index "local_partitioned_table_2_100_200_col_1_key" for table "local_partitioned_table_2_100_200"
|
||||||
|
ALTER TABLE local_partitioned_table_2 ATTACH PARTITION local_partitioned_table_2_100_200 FOR VALUES FROM (100) TO (200);
|
||||||
|
DEBUG: verifying table "local_partitioned_table_2_100_200"
|
||||||
|
-- define foreign key between parent tables
|
||||||
|
ALTER TABLE local_partitioned_table_1 ADD CONSTRAINT fkey_10 FOREIGN KEY (col_1) REFERENCES local_partitioned_table_2(col_1);
|
||||||
|
DEBUG: DDL command invalidates foreign key graph
|
||||||
|
-- in below two show that attaching partition invalidates foreign
|
||||||
|
-- key cache as parent table is involved in a foreign key relationship
|
||||||
|
CREATE TABLE local_partitioned_table_2_200_300 PARTITION OF local_partitioned_table_2 FOR VALUES FROM (200) TO (300);
|
||||||
|
DEBUG: CREATE TABLE / UNIQUE will create implicit index "local_partitioned_table_2_200_300_col_1_key" for table "local_partitioned_table_2_200_300"
|
||||||
|
DEBUG: DDL command invalidates foreign key graph
|
||||||
|
CREATE TABLE local_partitioned_table_1_300_400 (col_1 INT UNIQUE, col_2 INT);
|
||||||
|
DEBUG: CREATE TABLE / UNIQUE will create implicit index "local_partitioned_table_1_300_400_col_1_key" for table "local_partitioned_table_1_300_400"
|
||||||
|
ALTER TABLE local_partitioned_table_1 ATTACH PARTITION local_partitioned_table_1_300_400 FOR VALUES FROM (300) TO (400);
|
||||||
|
DEBUG: verifying table "local_partitioned_table_1_300_400"
|
||||||
|
DEBUG: DDL command invalidates foreign key graph
|
||||||
set client_min_messages to error;
|
set client_min_messages to error;
|
||||||
SET search_path TO public;
|
SET search_path TO public;
|
||||||
DROP SCHEMA fkey_graph CASCADE;
|
DROP SCHEMA fkey_graph CASCADE;
|
||||||
|
|
|
@ -447,6 +447,29 @@ SELECT oid::regclass::text AS tablename
|
||||||
FROM get_foreign_key_connected_relations('partitioned_table_1_300_400') AS f(oid oid)
|
FROM get_foreign_key_connected_relations('partitioned_table_1_300_400') AS f(oid oid)
|
||||||
ORDER BY tablename;
|
ORDER BY tablename;
|
||||||
|
|
||||||
|
CREATE TABLE local_partitioned_table_1 (col_1 INT UNIQUE, col_2 INT) PARTITION BY RANGE (col_1);
|
||||||
|
CREATE TABLE local_partitioned_table_2 (col_1 INT UNIQUE, col_2 INT) PARTITION BY RANGE (col_1);
|
||||||
|
|
||||||
|
-- in below two show that attaching a partition doesn't invalidate
|
||||||
|
-- foreign key cache as parent table isn't involved in any foreign
|
||||||
|
-- key relationship
|
||||||
|
|
||||||
|
CREATE TABLE local_partitioned_table_1_100_200 PARTITION OF local_partitioned_table_1 FOR VALUES FROM (100) TO (200);
|
||||||
|
|
||||||
|
CREATE TABLE local_partitioned_table_2_100_200 (col_1 INT UNIQUE, col_2 INT);
|
||||||
|
ALTER TABLE local_partitioned_table_2 ATTACH PARTITION local_partitioned_table_2_100_200 FOR VALUES FROM (100) TO (200);
|
||||||
|
|
||||||
|
-- define foreign key between parent tables
|
||||||
|
ALTER TABLE local_partitioned_table_1 ADD CONSTRAINT fkey_10 FOREIGN KEY (col_1) REFERENCES local_partitioned_table_2(col_1);
|
||||||
|
|
||||||
|
-- in below two show that attaching partition invalidates foreign
|
||||||
|
-- key cache as parent table is involved in a foreign key relationship
|
||||||
|
|
||||||
|
CREATE TABLE local_partitioned_table_2_200_300 PARTITION OF local_partitioned_table_2 FOR VALUES FROM (200) TO (300);
|
||||||
|
|
||||||
|
CREATE TABLE local_partitioned_table_1_300_400 (col_1 INT UNIQUE, col_2 INT);
|
||||||
|
ALTER TABLE local_partitioned_table_1 ATTACH PARTITION local_partitioned_table_1_300_400 FOR VALUES FROM (300) TO (400);
|
||||||
|
|
||||||
set client_min_messages to error;
|
set client_min_messages to error;
|
||||||
|
|
||||||
SET search_path TO public;
|
SET search_path TO public;
|
||||||
|
|
Loading…
Reference in New Issue