Fix tests for undistribute_table

support-partitioning-for-citus-local-tables
Ahmet Gedemenli 2021-08-25 18:47:07 +03:00
parent 8b797dec05
commit f9932fe44d
1 changed files with 18 additions and 6 deletions

View File

@ -395,7 +395,7 @@ BEGIN;
set citus.multi_shard_modify_mode to 'sequential';
ALTER TABLE partitioned_table_1_100_200 ADD CONSTRAINT non_inherited_fkey FOREIGN KEY(col_1) REFERENCES reference_table_3(col_1);
SELECT undistribute_table('partitioned_table_2', cascade_via_foreign_keys=>true);
ERROR: cannot cascade operation via foreign keys as partition table undistribute_table_cascade.partitioned_table_1_100_200 involved in a foreign key relationship that is not inherited from it's parent table
ERROR: cannot complete operation because table reference_table_3 is referenced by a foreign key
ROLLBACK;
BEGIN;
set citus.multi_shard_modify_mode to 'sequential';
@ -407,7 +407,7 @@ BEGIN;
set citus.multi_shard_modify_mode to 'sequential';
ALTER TABLE partitioned_table_1_100_200 ADD CONSTRAINT non_inherited_fkey FOREIGN KEY(col_1) REFERENCES reference_table_3(col_1);
SELECT undistribute_table('partitioned_table_2', cascade_via_foreign_keys=>true);
ERROR: cannot cascade operation via foreign keys as partition table undistribute_table_cascade.partitioned_table_1_100_200 involved in a foreign key relationship that is not inherited from it's parent table
ERROR: cannot complete operation because table reference_table_3 is referenced by a foreign key
ROLLBACK;
BEGIN;
set citus.multi_shard_modify_mode to 'sequential';
@ -425,7 +425,11 @@ BEGIN;
set citus.multi_shard_modify_mode to 'sequential';
ALTER TABLE distributed_table_4 ADD CONSTRAINT non_inherited_fkey FOREIGN KEY (col_1) REFERENCES partitioned_table_2_100_200(col_1);
SELECT undistribute_table('distributed_table_4', cascade_via_foreign_keys=>true);
ERROR: cannot cascade operation via foreign keys as partition table undistribute_table_cascade.partitioned_table_2_100_200 involved in a foreign key relationship that is not inherited from it's parent table
undistribute_table
---------------------------------------------------------------------
(1 row)
ROLLBACK;
BEGIN;
set citus.multi_shard_modify_mode to 'sequential';
@ -437,7 +441,11 @@ BEGIN;
set citus.multi_shard_modify_mode to 'sequential';
ALTER TABLE distributed_table_4 ADD CONSTRAINT non_inherited_fkey FOREIGN KEY (col_1) REFERENCES partitioned_table_1_100_200(col_1);
SELECT undistribute_table('partitioned_table_2', cascade_via_foreign_keys=>true);
ERROR: cannot cascade operation via foreign keys as partition table undistribute_table_cascade.partitioned_table_1_100_200 involved in a foreign key relationship that is not inherited from it's parent table
undistribute_table
---------------------------------------------------------------------
(1 row)
ROLLBACK;
BEGIN;
set citus.multi_shard_modify_mode to 'sequential';
@ -455,13 +463,17 @@ BEGIN;
set citus.multi_shard_modify_mode to 'sequential';
ALTER TABLE partitioned_table_1_100_200 ADD CONSTRAINT fkey FOREIGN KEY(col_1) REFERENCES distributed_table_4(col_1);
SELECT undistribute_table('distributed_table_4', cascade_via_foreign_keys=>true);
ERROR: cannot cascade operation via foreign keys as partition table undistribute_table_cascade.partitioned_table_1_100_200 involved in a foreign key relationship that is not inherited from it's parent table
ERROR: cannot complete operation because table distributed_table_4 is referenced by a foreign key
ROLLBACK;
BEGIN;
set citus.multi_shard_modify_mode to 'sequential';
ALTER TABLE partitioned_table_2 ADD CONSTRAINT fkey FOREIGN KEY (col_1) REFERENCES partitioned_table_1_100_200(col_1);
SELECT undistribute_table('partitioned_table_2', cascade_via_foreign_keys=>true);
ERROR: cannot cascade operation via foreign keys as partition table undistribute_table_cascade.partitioned_table_1_100_200 involved in a foreign key relationship that is not inherited from it's parent table
undistribute_table
---------------------------------------------------------------------
(1 row)
ROLLBACK;
BEGIN;
set citus.multi_shard_modify_mode to 'sequential';