Fix citus_local_tables

pull/7286/head
ivyazmitinov 2024-06-28 22:08:49 +02:00
parent a227bcc805
commit bf2572a927
2 changed files with 14 additions and 5 deletions

View File

@ -949,10 +949,15 @@ select count(*) from pg_constraint where conname = 'fkey_test_drop';
-- verify we still preserve the child-parent hierarchy after all conversions
-- check the shard partition
select inhrelid::regclass from pg_inherits where (select inhparent::regclass::text) ~ '^parent_1_\d{7}$' order by 1;
inhrelid
SELECT count(*) = 1 AS child_parent_hierarchy_test
FROM pg_inherits
WHERE (SELECT inhparent::regclass::text) ~ '^parent_1_\d{7}$'
-- order of the child shard id is not guaranteed, but should be either 1904004 or 04
AND (inhrelid::regclass::text) IN ('parent_1_child_1_1904004', 'parent_1_child_1_1904006')
ORDER BY 1;
child_parent_hierarchy_test
---------------------------------------------------------------------
parent_1_child_1_1904006
t
(1 row)
-- check the shell partition

View File

@ -579,10 +579,14 @@ alter table parent_1 add constraint fkey2 foreign key(a) references parent_2(a);
SELECT create_reference_table('ref_table');
alter table parent_1 drop constraint fkey_test_drop;
select count(*) from pg_constraint where conname = 'fkey_test_drop';
SELECT * FROM pg_dist_shard ORDER BY shardid;
-- verify we still preserve the child-parent hierarchy after all conversions
-- check the shard partition
select inhrelid::regclass from pg_inherits where (select inhparent::regclass::text) ~ '^parent_1_\d{7}$' order by 1;
SELECT count(*) = 1 AS child_parent_hierarchy_test
FROM pg_inherits
WHERE (SELECT inhparent::regclass::text) ~ '^parent_1_\d{7}$'
-- order of the child shard id is not guaranteed, but should be either 1904004 or 04
AND (inhrelid::regclass::text) IN ('parent_1_child_1_1904004', 'parent_1_child_1_1904006')
ORDER BY 1;
-- check the shell partition
select inhrelid::regclass from pg_inherits where inhparent='parent_1'::regclass order by 1;