From 29864cfa9fddf2bf872e999ac3b319adf8b32f79 Mon Sep 17 00:00:00 2001 From: Mehmet Yilmaz Date: Thu, 14 Aug 2025 13:23:25 +0000 Subject: [PATCH] Restructure foreign key handling code for ATTACH/DETACH 53af9491a0439720094a11b72602952d79f59ac7 --- .../citus_non_blocking_split_columnar.out | 286 +++++++++--------- .../citus_non_blocking_split_shards.out | 14 +- .../citus_split_shard_by_split_points.out | 14 +- ...citus_split_shard_columnar_partitioned.out | 286 +++++++++--------- .../multi_colocated_shard_rebalance.out | 19 +- .../multi_create_table_constraints.out | 4 +- .../regress/expected/multi_metadata_sync.out | 8 +- .../expected/multi_metadata_sync_0.out | 8 +- .../regress/expected/multi_partitioning.out | 4 +- .../expected/multi_tenant_isolation.out | 86 +++--- .../multi_tenant_isolation_nonblocking.out | 86 +++--- .../expected/multi_test_catalog_views.out | 5 +- .../expected/shard_move_constraints.out | 52 ++-- .../shard_move_constraints_blocking.out | 64 ++-- .../sql/citus_non_blocking_split_columnar.sql | 12 +- ...citus_split_shard_columnar_partitioned.sql | 12 +- .../sql/multi_colocated_shard_rebalance.sql | 7 +- .../regress/sql/multi_test_catalog_views.sql | 5 +- 18 files changed, 490 insertions(+), 482 deletions(-) diff --git a/src/test/regress/expected/citus_non_blocking_split_columnar.out b/src/test/regress/expected/citus_non_blocking_split_columnar.out index 0d5c74254..381918d8b 100644 --- a/src/test/regress/expected/citus_non_blocking_split_columnar.out +++ b/src/test/regress/expected/citus_non_blocking_split_columnar.out @@ -160,31 +160,31 @@ SELECT pg_reload_conf(); FROM pg_catalog.pg_class tbl JOIN public.table_fkeys fk on tbl.oid = fk.relid WHERE tbl.relname like '%_89%' - ORDER BY 1, 2; - relname | Constraint | Definition + ORDER BY 1, 3; + relname | Constraint | Definition --------------------------------------------------------------------- - sensors_2020_01_01_8970002 | fkey_from_child_to_child_8970002 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) - sensors_2020_01_01_8970002 | fkey_from_child_to_dist_8970002 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970008(measureid) - sensors_2020_01_01_8970002 | fkey_from_child_to_parent_8970002 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970009(eventdatetime, measureid) - sensors_2020_01_01_8970002 | fkey_from_child_to_ref_8970002 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_2020_01_01_8970002 | fkey_from_parent_to_child_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) - sensors_2020_01_01_8970002 | fkey_from_parent_to_dist_8970000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970008(measureid) - sensors_2020_01_01_8970002 | fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970009(eventdatetime, measureid) - sensors_2020_01_01_8970002 | fkey_from_parent_to_ref_8970000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_2020_01_01_8970002 | sensors_2020_01_01_8970002_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) - sensors_8970000 | fkey_from_parent_to_child_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) - sensors_8970000 | fkey_from_parent_to_dist_8970000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970008(measureid) - sensors_8970000 | fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970009(eventdatetime, measureid) - sensors_8970000 | fkey_from_parent_to_ref_8970000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_8970000 | sensors_8970000_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) - sensors_news_8970003 | fkey_from_parent_to_child_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) - sensors_news_8970003 | fkey_from_parent_to_dist_8970000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970008(measureid) - sensors_news_8970003 | fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970009(eventdatetime, measureid) - sensors_news_8970003 | fkey_from_parent_to_ref_8970000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_old_8970001 | fkey_from_parent_to_child_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) - sensors_old_8970001 | fkey_from_parent_to_dist_8970000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970008(measureid) - sensors_old_8970001 | fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970009(eventdatetime, measureid) - sensors_old_8970001 | fkey_from_parent_to_ref_8970000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8970002 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) + sensors_2020_01_01_8970002 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) + sensors_2020_01_01_8970002 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) + sensors_2020_01_01_8970002 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970009(eventdatetime, measureid) + sensors_2020_01_01_8970002 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970009(eventdatetime, measureid) + sensors_2020_01_01_8970002 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970008(measureid) + sensors_2020_01_01_8970002 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970008(measureid) + sensors_2020_01_01_8970002 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8970002 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_8970000 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) + sensors_8970000 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) + sensors_8970000 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970009(eventdatetime, measureid) + sensors_8970000 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970008(measureid) + sensors_8970000 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_news_8970003 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) + sensors_news_8970003 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970009(eventdatetime, measureid) + sensors_news_8970003 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970008(measureid) + sensors_news_8970003 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_old_8970001 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) + sensors_old_8970001 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970009(eventdatetime, measureid) + sensors_old_8970001 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970008(measureid) + sensors_old_8970001 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) (22 rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename like '%_89%' ORDER BY 1,2; @@ -240,7 +240,7 @@ SELECT pg_reload_conf(); FROM pg_catalog.pg_class tbl JOIN public.table_fkeys fk on tbl.oid = fk.relid WHERE tbl.relname like '%_89%' - ORDER BY 1, 2; + ORDER BY 1, 3; relname | Constraint | Definition --------------------------------------------------------------------- (0 rows) @@ -368,31 +368,31 @@ SELECT public.wait_for_resource_cleanup(); FROM pg_catalog.pg_class tbl JOIN public.table_fkeys fk on tbl.oid = fk.relid WHERE tbl.relname like '%_89%' - ORDER BY 1, 2; - relname | Constraint | Definition + ORDER BY 1, 3; + relname | Constraint | Definition --------------------------------------------------------------------- - sensors_2020_01_01_8999004 | fkey_from_child_to_child_8999004 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) - sensors_2020_01_01_8999004 | fkey_from_child_to_dist_8999004 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999016(measureid) - sensors_2020_01_01_8999004 | fkey_from_child_to_parent_8999004 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999018(eventdatetime, measureid) - sensors_2020_01_01_8999004 | fkey_from_child_to_ref_8999004 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_2020_01_01_8999004 | fkey_from_parent_to_child_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) - sensors_2020_01_01_8999004 | fkey_from_parent_to_dist_8999000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999016(measureid) - sensors_2020_01_01_8999004 | fkey_from_parent_to_parent_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999018(eventdatetime, measureid) - sensors_2020_01_01_8999004 | fkey_from_parent_to_ref_8999000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_2020_01_01_8999004 | sensors_2020_01_01_8999004_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) - sensors_8999000 | fkey_from_parent_to_child_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) - sensors_8999000 | fkey_from_parent_to_dist_8999000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999016(measureid) - sensors_8999000 | fkey_from_parent_to_parent_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999018(eventdatetime, measureid) - sensors_8999000 | fkey_from_parent_to_ref_8999000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_8999000 | sensors_8999000_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) - sensors_news_8999006 | fkey_from_parent_to_child_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) - sensors_news_8999006 | fkey_from_parent_to_dist_8999000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999016(measureid) - sensors_news_8999006 | fkey_from_parent_to_parent_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999018(eventdatetime, measureid) - sensors_news_8999006 | fkey_from_parent_to_ref_8999000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_old_8999002 | fkey_from_parent_to_child_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) - sensors_old_8999002 | fkey_from_parent_to_dist_8999000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999016(measureid) - sensors_old_8999002 | fkey_from_parent_to_parent_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999018(eventdatetime, measureid) - sensors_old_8999002 | fkey_from_parent_to_ref_8999000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8999004 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) + sensors_2020_01_01_8999004 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) + sensors_2020_01_01_8999004 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) + sensors_2020_01_01_8999004 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999018(eventdatetime, measureid) + sensors_2020_01_01_8999004 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999018(eventdatetime, measureid) + sensors_2020_01_01_8999004 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999016(measureid) + sensors_2020_01_01_8999004 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999016(measureid) + sensors_2020_01_01_8999004 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8999004 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_8999000 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) + sensors_8999000 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) + sensors_8999000 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999018(eventdatetime, measureid) + sensors_8999000 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999016(measureid) + sensors_8999000 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_news_8999006 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) + sensors_news_8999006 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999018(eventdatetime, measureid) + sensors_news_8999006 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999016(measureid) + sensors_news_8999006 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_old_8999002 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) + sensors_old_8999002 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999018(eventdatetime, measureid) + sensors_old_8999002 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999016(measureid) + sensors_old_8999002 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) (22 rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename like '%_89%' ORDER BY 1,2; @@ -448,31 +448,31 @@ SELECT public.wait_for_resource_cleanup(); FROM pg_catalog.pg_class tbl JOIN public.table_fkeys fk on tbl.oid = fk.relid WHERE tbl.relname like '%_89%' - ORDER BY 1, 2; - relname | Constraint | Definition + ORDER BY 1, 3; + relname | Constraint | Definition --------------------------------------------------------------------- - sensors_2020_01_01_8999005 | fkey_from_child_to_child_8999005 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) - sensors_2020_01_01_8999005 | fkey_from_child_to_dist_8999005 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) - sensors_2020_01_01_8999005 | fkey_from_child_to_parent_8999005 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) - sensors_2020_01_01_8999005 | fkey_from_child_to_ref_8999005 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_2020_01_01_8999005 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) - sensors_2020_01_01_8999005 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) - sensors_2020_01_01_8999005 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) - sensors_2020_01_01_8999005 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_2020_01_01_8999005 | sensors_2020_01_01_8999005_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) - sensors_8999001 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) - sensors_8999001 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) - sensors_8999001 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) - sensors_8999001 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_8999001 | sensors_8999001_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) - sensors_news_8999007 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) - sensors_news_8999007 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) - sensors_news_8999007 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) - sensors_news_8999007 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_old_8999003 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) - sensors_old_8999003 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) - sensors_old_8999003 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) - sensors_old_8999003 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_8999001 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_8999001 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_8999001 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) + sensors_8999001 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) + sensors_8999001 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_news_8999007 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_news_8999007 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) + sensors_news_8999007 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) + sensors_news_8999007 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_old_8999003 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_old_8999003 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) + sensors_old_8999003 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) + sensors_old_8999003 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) (22 rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename like '%_89%' ORDER BY 1,2; @@ -634,31 +634,31 @@ SELECT public.wait_for_resource_cleanup(); FROM pg_catalog.pg_class tbl JOIN public.table_fkeys fk on tbl.oid = fk.relid WHERE tbl.relname like '%_89%' - ORDER BY 1, 2; - relname | Constraint | Definition + ORDER BY 1, 3; + relname | Constraint | Definition --------------------------------------------------------------------- - sensors_2020_01_01_8999104 | fkey_from_child_to_child_8999104 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) - sensors_2020_01_01_8999104 | fkey_from_child_to_dist_8999104 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999116(measureid) - sensors_2020_01_01_8999104 | fkey_from_child_to_parent_8999104 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999118(eventdatetime, measureid) - sensors_2020_01_01_8999104 | fkey_from_child_to_ref_8999104 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_2020_01_01_8999104 | fkey_from_parent_to_child_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) - sensors_2020_01_01_8999104 | fkey_from_parent_to_dist_8999100 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999116(measureid) - sensors_2020_01_01_8999104 | fkey_from_parent_to_parent_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999118(eventdatetime, measureid) - sensors_2020_01_01_8999104 | fkey_from_parent_to_ref_8999100 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_2020_01_01_8999104 | sensors_2020_01_01_8999104_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) - sensors_8999100 | fkey_from_parent_to_child_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) - sensors_8999100 | fkey_from_parent_to_dist_8999100 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999116(measureid) - sensors_8999100 | fkey_from_parent_to_parent_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999118(eventdatetime, measureid) - sensors_8999100 | fkey_from_parent_to_ref_8999100 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_8999100 | sensors_8999100_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) - sensors_news_8999106 | fkey_from_parent_to_child_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) - sensors_news_8999106 | fkey_from_parent_to_dist_8999100 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999116(measureid) - sensors_news_8999106 | fkey_from_parent_to_parent_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999118(eventdatetime, measureid) - sensors_news_8999106 | fkey_from_parent_to_ref_8999100 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_old_8999102 | fkey_from_parent_to_child_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) - sensors_old_8999102 | fkey_from_parent_to_dist_8999100 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999116(measureid) - sensors_old_8999102 | fkey_from_parent_to_parent_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999118(eventdatetime, measureid) - sensors_old_8999102 | fkey_from_parent_to_ref_8999100 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8999104 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) + sensors_2020_01_01_8999104 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) + sensors_2020_01_01_8999104 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) + sensors_2020_01_01_8999104 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999118(eventdatetime, measureid) + sensors_2020_01_01_8999104 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999118(eventdatetime, measureid) + sensors_2020_01_01_8999104 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999116(measureid) + sensors_2020_01_01_8999104 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999116(measureid) + sensors_2020_01_01_8999104 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8999104 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_8999100 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) + sensors_8999100 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) + sensors_8999100 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999118(eventdatetime, measureid) + sensors_8999100 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999116(measureid) + sensors_8999100 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_news_8999106 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) + sensors_news_8999106 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999118(eventdatetime, measureid) + sensors_news_8999106 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999116(measureid) + sensors_news_8999106 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_old_8999102 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) + sensors_old_8999102 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999118(eventdatetime, measureid) + sensors_old_8999102 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999116(measureid) + sensors_old_8999102 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) (22 rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename like '%_89%' ORDER BY 1,2; @@ -714,53 +714,53 @@ SELECT public.wait_for_resource_cleanup(); FROM pg_catalog.pg_class tbl JOIN public.table_fkeys fk on tbl.oid = fk.relid WHERE tbl.relname like '%_89%' - ORDER BY 1, 2; - relname | Constraint | Definition + ORDER BY 1, 3; + relname | Constraint | Definition --------------------------------------------------------------------- - sensors_2020_01_01_8999005 | fkey_from_child_to_child_8999005 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) - sensors_2020_01_01_8999005 | fkey_from_child_to_dist_8999005 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) - sensors_2020_01_01_8999005 | fkey_from_child_to_parent_8999005 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) - sensors_2020_01_01_8999005 | fkey_from_child_to_ref_8999005 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_2020_01_01_8999005 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) - sensors_2020_01_01_8999005 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) - sensors_2020_01_01_8999005 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) - sensors_2020_01_01_8999005 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_2020_01_01_8999005 | sensors_2020_01_01_8999005_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) - sensors_2020_01_01_8999105 | fkey_from_child_to_child_8999105 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) - sensors_2020_01_01_8999105 | fkey_from_child_to_dist_8999105 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999117(measureid) - sensors_2020_01_01_8999105 | fkey_from_child_to_parent_8999105 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999119(eventdatetime, measureid) - sensors_2020_01_01_8999105 | fkey_from_child_to_ref_8999105 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_2020_01_01_8999105 | fkey_from_parent_to_child_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) - sensors_2020_01_01_8999105 | fkey_from_parent_to_dist_8999101 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999117(measureid) - sensors_2020_01_01_8999105 | fkey_from_parent_to_parent_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999119(eventdatetime, measureid) - sensors_2020_01_01_8999105 | fkey_from_parent_to_ref_8999101 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_2020_01_01_8999105 | sensors_2020_01_01_8999105_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) - sensors_8999001 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) - sensors_8999001 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) - sensors_8999001 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) - sensors_8999001 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_8999001 | sensors_8999001_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) - sensors_8999101 | fkey_from_parent_to_child_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) - sensors_8999101 | fkey_from_parent_to_dist_8999101 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999117(measureid) - sensors_8999101 | fkey_from_parent_to_parent_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999119(eventdatetime, measureid) - sensors_8999101 | fkey_from_parent_to_ref_8999101 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_8999101 | sensors_8999101_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) - sensors_news_8999007 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) - sensors_news_8999007 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) - sensors_news_8999007 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) - sensors_news_8999007 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_news_8999107 | fkey_from_parent_to_child_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) - sensors_news_8999107 | fkey_from_parent_to_dist_8999101 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999117(measureid) - sensors_news_8999107 | fkey_from_parent_to_parent_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999119(eventdatetime, measureid) - sensors_news_8999107 | fkey_from_parent_to_ref_8999101 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_old_8999003 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) - sensors_old_8999003 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) - sensors_old_8999003 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) - sensors_old_8999003 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_old_8999103 | fkey_from_parent_to_child_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) - sensors_old_8999103 | fkey_from_parent_to_dist_8999101 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999117(measureid) - sensors_old_8999103 | fkey_from_parent_to_parent_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999119(eventdatetime, measureid) - sensors_old_8999103 | fkey_from_parent_to_ref_8999101 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8999105 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) + sensors_2020_01_01_8999105 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) + sensors_2020_01_01_8999105 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) + sensors_2020_01_01_8999105 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999119(eventdatetime, measureid) + sensors_2020_01_01_8999105 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999119(eventdatetime, measureid) + sensors_2020_01_01_8999105 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999117(measureid) + sensors_2020_01_01_8999105 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999117(measureid) + sensors_2020_01_01_8999105 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8999105 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_8999001 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_8999001 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_8999001 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) + sensors_8999001 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) + sensors_8999001 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_8999101 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) + sensors_8999101 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) + sensors_8999101 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999119(eventdatetime, measureid) + sensors_8999101 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999117(measureid) + sensors_8999101 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_news_8999007 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_news_8999007 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) + sensors_news_8999007 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) + sensors_news_8999007 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_news_8999107 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) + sensors_news_8999107 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999119(eventdatetime, measureid) + sensors_news_8999107 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999117(measureid) + sensors_news_8999107 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_old_8999003 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_old_8999003 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) + sensors_old_8999003 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) + sensors_old_8999003 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_old_8999103 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) + sensors_old_8999103 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999119(eventdatetime, measureid) + sensors_old_8999103 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999117(measureid) + sensors_old_8999103 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) (44 rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename like '%_89%' ORDER BY 1,2; diff --git a/src/test/regress/expected/citus_non_blocking_split_shards.out b/src/test/regress/expected/citus_non_blocking_split_shards.out index 1f42eab61..0de707390 100644 --- a/src/test/regress/expected/citus_non_blocking_split_shards.out +++ b/src/test/regress/expected/citus_non_blocking_split_shards.out @@ -134,7 +134,7 @@ SELECT shard.shardid, logicalrelid, shardminvalue, shardmaxvalue, nodename, node ORDER BY 1, 2; relname | Constraint | Definition --------------------------------------------------------------------- - sensors_8981000 | fkey_table_to_dist_8981000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8981003(measureid) + sensors_8981000 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8981003(measureid) (1 row) SELECT tablename, indexdef FROM pg_indexes WHERE tablename like 'sensors_%' ORDER BY 1,2; @@ -175,7 +175,7 @@ SELECT shard.shardid, logicalrelid, shardminvalue, shardmaxvalue, nodename, node ORDER BY 1, 2; relname | Constraint | Definition --------------------------------------------------------------------- - sensors_8981001 | fkey_table_to_dist_8981001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8981004(measureid) + sensors_8981001 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8981004(measureid) (1 row) SELECT tablename, indexdef FROM pg_indexes WHERE tablename like 'sensors_%' ORDER BY 1,2; @@ -320,8 +320,8 @@ SELECT shard.shardid, logicalrelid, shardminvalue, shardmaxvalue, nodename, node ORDER BY 1, 2; relname | Constraint | Definition --------------------------------------------------------------------- - sensors_8981013 | fkey_table_to_dist_8981013 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8981016(measureid) - sensors_8981014 | fkey_table_to_dist_8981014 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8981017(measureid) + sensors_8981013 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8981016(measureid) + sensors_8981014 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8981017(measureid) (2 rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename like 'sensors_%' ORDER BY 1,2; @@ -368,9 +368,9 @@ SELECT shard.shardid, logicalrelid, shardminvalue, shardmaxvalue, nodename, node ORDER BY 1, 2; relname | Constraint | Definition --------------------------------------------------------------------- - sensors_8981007 | fkey_table_to_dist_8981007 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8981009(measureid) - sensors_8981008 | fkey_table_to_dist_8981008 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8981010(measureid) - sensors_8981015 | fkey_table_to_dist_8981015 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8981018(measureid) + sensors_8981007 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8981009(measureid) + sensors_8981008 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8981010(measureid) + sensors_8981015 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8981018(measureid) (3 rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename like 'sensors_%' ORDER BY 1,2; diff --git a/src/test/regress/expected/citus_split_shard_by_split_points.out b/src/test/regress/expected/citus_split_shard_by_split_points.out index 13f3b7a36..7f31210dd 100644 --- a/src/test/regress/expected/citus_split_shard_by_split_points.out +++ b/src/test/regress/expected/citus_split_shard_by_split_points.out @@ -130,7 +130,7 @@ SELECT shard.shardid, logicalrelid, shardminvalue, shardmaxvalue, nodename, node ORDER BY 1, 2; relname | Constraint | Definition --------------------------------------------------------------------- - sensors_8981000 | fkey_table_to_dist_8981000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8981003(measureid) + sensors_8981000 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8981003(measureid) (1 row) SELECT tablename, indexdef FROM pg_indexes WHERE tablename like 'sensors_%' ORDER BY 1,2; @@ -171,7 +171,7 @@ SELECT shard.shardid, logicalrelid, shardminvalue, shardmaxvalue, nodename, node ORDER BY 1, 2; relname | Constraint | Definition --------------------------------------------------------------------- - sensors_8981001 | fkey_table_to_dist_8981001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8981004(measureid) + sensors_8981001 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8981004(measureid) (1 row) SELECT tablename, indexdef FROM pg_indexes WHERE tablename like 'sensors_%' ORDER BY 1,2; @@ -316,8 +316,8 @@ SELECT shard.shardid, logicalrelid, shardminvalue, shardmaxvalue, nodename, node ORDER BY 1, 2; relname | Constraint | Definition --------------------------------------------------------------------- - sensors_8981013 | fkey_table_to_dist_8981013 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8981016(measureid) - sensors_8981014 | fkey_table_to_dist_8981014 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8981017(measureid) + sensors_8981013 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8981016(measureid) + sensors_8981014 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8981017(measureid) (2 rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename like 'sensors_%' ORDER BY 1,2; @@ -364,9 +364,9 @@ SELECT shard.shardid, logicalrelid, shardminvalue, shardmaxvalue, nodename, node ORDER BY 1, 2; relname | Constraint | Definition --------------------------------------------------------------------- - sensors_8981007 | fkey_table_to_dist_8981007 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8981009(measureid) - sensors_8981008 | fkey_table_to_dist_8981008 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8981010(measureid) - sensors_8981015 | fkey_table_to_dist_8981015 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8981018(measureid) + sensors_8981007 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8981009(measureid) + sensors_8981008 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8981010(measureid) + sensors_8981015 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8981018(measureid) (3 rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename like 'sensors_%' ORDER BY 1,2; diff --git a/src/test/regress/expected/citus_split_shard_columnar_partitioned.out b/src/test/regress/expected/citus_split_shard_columnar_partitioned.out index 5dc0c1ebc..2655b56e8 100644 --- a/src/test/regress/expected/citus_split_shard_columnar_partitioned.out +++ b/src/test/regress/expected/citus_split_shard_columnar_partitioned.out @@ -152,31 +152,31 @@ SELECT pg_reload_conf(); FROM pg_catalog.pg_class tbl JOIN public.table_fkeys fk on tbl.oid = fk.relid WHERE tbl.relname like '%_89%' - ORDER BY 1, 2; - relname | Constraint | Definition + ORDER BY 1, 3; + relname | Constraint | Definition --------------------------------------------------------------------- - sensors_2020_01_01_8970002 | fkey_from_child_to_child_8970002 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) - sensors_2020_01_01_8970002 | fkey_from_child_to_dist_8970002 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970008(measureid) - sensors_2020_01_01_8970002 | fkey_from_child_to_parent_8970002 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970009(eventdatetime, measureid) - sensors_2020_01_01_8970002 | fkey_from_child_to_ref_8970002 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_2020_01_01_8970002 | fkey_from_parent_to_child_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) - sensors_2020_01_01_8970002 | fkey_from_parent_to_dist_8970000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970008(measureid) - sensors_2020_01_01_8970002 | fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970009(eventdatetime, measureid) - sensors_2020_01_01_8970002 | fkey_from_parent_to_ref_8970000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_2020_01_01_8970002 | sensors_2020_01_01_8970002_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) - sensors_8970000 | fkey_from_parent_to_child_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) - sensors_8970000 | fkey_from_parent_to_dist_8970000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970008(measureid) - sensors_8970000 | fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970009(eventdatetime, measureid) - sensors_8970000 | fkey_from_parent_to_ref_8970000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_8970000 | sensors_8970000_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) - sensors_news_8970003 | fkey_from_parent_to_child_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) - sensors_news_8970003 | fkey_from_parent_to_dist_8970000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970008(measureid) - sensors_news_8970003 | fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970009(eventdatetime, measureid) - sensors_news_8970003 | fkey_from_parent_to_ref_8970000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_old_8970001 | fkey_from_parent_to_child_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) - sensors_old_8970001 | fkey_from_parent_to_dist_8970000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970008(measureid) - sensors_old_8970001 | fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970009(eventdatetime, measureid) - sensors_old_8970001 | fkey_from_parent_to_ref_8970000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8970002 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) + sensors_2020_01_01_8970002 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) + sensors_2020_01_01_8970002 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) + sensors_2020_01_01_8970002 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970009(eventdatetime, measureid) + sensors_2020_01_01_8970002 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970009(eventdatetime, measureid) + sensors_2020_01_01_8970002 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970008(measureid) + sensors_2020_01_01_8970002 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970008(measureid) + sensors_2020_01_01_8970002 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8970002 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_8970000 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) + sensors_8970000 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) + sensors_8970000 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970009(eventdatetime, measureid) + sensors_8970000 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970008(measureid) + sensors_8970000 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_news_8970003 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) + sensors_news_8970003 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970009(eventdatetime, measureid) + sensors_news_8970003 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970008(measureid) + sensors_news_8970003 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_old_8970001 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) + sensors_old_8970001 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970009(eventdatetime, measureid) + sensors_old_8970001 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970008(measureid) + sensors_old_8970001 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) (22 rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename like '%_89%' ORDER BY 1,2; @@ -232,7 +232,7 @@ SELECT pg_reload_conf(); FROM pg_catalog.pg_class tbl JOIN public.table_fkeys fk on tbl.oid = fk.relid WHERE tbl.relname like '%_89%' - ORDER BY 1, 2; + ORDER BY 1, 3; relname | Constraint | Definition --------------------------------------------------------------------- (0 rows) @@ -360,31 +360,31 @@ SELECT public.wait_for_resource_cleanup(); FROM pg_catalog.pg_class tbl JOIN public.table_fkeys fk on tbl.oid = fk.relid WHERE tbl.relname like '%_89%' - ORDER BY 1, 2; - relname | Constraint | Definition + ORDER BY 1, 3; + relname | Constraint | Definition --------------------------------------------------------------------- - sensors_2020_01_01_8999004 | fkey_from_child_to_child_8999004 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) - sensors_2020_01_01_8999004 | fkey_from_child_to_dist_8999004 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999016(measureid) - sensors_2020_01_01_8999004 | fkey_from_child_to_parent_8999004 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999018(eventdatetime, measureid) - sensors_2020_01_01_8999004 | fkey_from_child_to_ref_8999004 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_2020_01_01_8999004 | fkey_from_parent_to_child_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) - sensors_2020_01_01_8999004 | fkey_from_parent_to_dist_8999000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999016(measureid) - sensors_2020_01_01_8999004 | fkey_from_parent_to_parent_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999018(eventdatetime, measureid) - sensors_2020_01_01_8999004 | fkey_from_parent_to_ref_8999000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_2020_01_01_8999004 | sensors_2020_01_01_8999004_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) - sensors_8999000 | fkey_from_parent_to_child_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) - sensors_8999000 | fkey_from_parent_to_dist_8999000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999016(measureid) - sensors_8999000 | fkey_from_parent_to_parent_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999018(eventdatetime, measureid) - sensors_8999000 | fkey_from_parent_to_ref_8999000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_8999000 | sensors_8999000_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) - sensors_news_8999006 | fkey_from_parent_to_child_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) - sensors_news_8999006 | fkey_from_parent_to_dist_8999000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999016(measureid) - sensors_news_8999006 | fkey_from_parent_to_parent_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999018(eventdatetime, measureid) - sensors_news_8999006 | fkey_from_parent_to_ref_8999000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_old_8999002 | fkey_from_parent_to_child_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) - sensors_old_8999002 | fkey_from_parent_to_dist_8999000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999016(measureid) - sensors_old_8999002 | fkey_from_parent_to_parent_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999018(eventdatetime, measureid) - sensors_old_8999002 | fkey_from_parent_to_ref_8999000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8999004 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) + sensors_2020_01_01_8999004 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) + sensors_2020_01_01_8999004 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) + sensors_2020_01_01_8999004 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999018(eventdatetime, measureid) + sensors_2020_01_01_8999004 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999018(eventdatetime, measureid) + sensors_2020_01_01_8999004 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999016(measureid) + sensors_2020_01_01_8999004 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999016(measureid) + sensors_2020_01_01_8999004 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8999004 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_8999000 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) + sensors_8999000 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) + sensors_8999000 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999018(eventdatetime, measureid) + sensors_8999000 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999016(measureid) + sensors_8999000 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_news_8999006 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) + sensors_news_8999006 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999018(eventdatetime, measureid) + sensors_news_8999006 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999016(measureid) + sensors_news_8999006 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_old_8999002 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) + sensors_old_8999002 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999018(eventdatetime, measureid) + sensors_old_8999002 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999016(measureid) + sensors_old_8999002 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) (22 rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename like '%_89%' ORDER BY 1,2; @@ -440,31 +440,31 @@ SELECT public.wait_for_resource_cleanup(); FROM pg_catalog.pg_class tbl JOIN public.table_fkeys fk on tbl.oid = fk.relid WHERE tbl.relname like '%_89%' - ORDER BY 1, 2; - relname | Constraint | Definition + ORDER BY 1, 3; + relname | Constraint | Definition --------------------------------------------------------------------- - sensors_2020_01_01_8999005 | fkey_from_child_to_child_8999005 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) - sensors_2020_01_01_8999005 | fkey_from_child_to_dist_8999005 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) - sensors_2020_01_01_8999005 | fkey_from_child_to_parent_8999005 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) - sensors_2020_01_01_8999005 | fkey_from_child_to_ref_8999005 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_2020_01_01_8999005 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) - sensors_2020_01_01_8999005 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) - sensors_2020_01_01_8999005 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) - sensors_2020_01_01_8999005 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_2020_01_01_8999005 | sensors_2020_01_01_8999005_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) - sensors_8999001 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) - sensors_8999001 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) - sensors_8999001 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) - sensors_8999001 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_8999001 | sensors_8999001_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) - sensors_news_8999007 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) - sensors_news_8999007 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) - sensors_news_8999007 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) - sensors_news_8999007 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_old_8999003 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) - sensors_old_8999003 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) - sensors_old_8999003 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) - sensors_old_8999003 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_8999001 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_8999001 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_8999001 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) + sensors_8999001 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) + sensors_8999001 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_news_8999007 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_news_8999007 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) + sensors_news_8999007 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) + sensors_news_8999007 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_old_8999003 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_old_8999003 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) + sensors_old_8999003 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) + sensors_old_8999003 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) (22 rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename like '%_89%' ORDER BY 1,2; @@ -626,31 +626,31 @@ SELECT public.wait_for_resource_cleanup(); FROM pg_catalog.pg_class tbl JOIN public.table_fkeys fk on tbl.oid = fk.relid WHERE tbl.relname like '%_89%' - ORDER BY 1, 2; - relname | Constraint | Definition + ORDER BY 1, 3; + relname | Constraint | Definition --------------------------------------------------------------------- - sensors_2020_01_01_8999104 | fkey_from_child_to_child_8999104 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) - sensors_2020_01_01_8999104 | fkey_from_child_to_dist_8999104 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999116(measureid) - sensors_2020_01_01_8999104 | fkey_from_child_to_parent_8999104 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999118(eventdatetime, measureid) - sensors_2020_01_01_8999104 | fkey_from_child_to_ref_8999104 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_2020_01_01_8999104 | fkey_from_parent_to_child_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) - sensors_2020_01_01_8999104 | fkey_from_parent_to_dist_8999100 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999116(measureid) - sensors_2020_01_01_8999104 | fkey_from_parent_to_parent_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999118(eventdatetime, measureid) - sensors_2020_01_01_8999104 | fkey_from_parent_to_ref_8999100 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_2020_01_01_8999104 | sensors_2020_01_01_8999104_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) - sensors_8999100 | fkey_from_parent_to_child_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) - sensors_8999100 | fkey_from_parent_to_dist_8999100 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999116(measureid) - sensors_8999100 | fkey_from_parent_to_parent_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999118(eventdatetime, measureid) - sensors_8999100 | fkey_from_parent_to_ref_8999100 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_8999100 | sensors_8999100_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) - sensors_news_8999106 | fkey_from_parent_to_child_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) - sensors_news_8999106 | fkey_from_parent_to_dist_8999100 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999116(measureid) - sensors_news_8999106 | fkey_from_parent_to_parent_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999118(eventdatetime, measureid) - sensors_news_8999106 | fkey_from_parent_to_ref_8999100 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_old_8999102 | fkey_from_parent_to_child_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) - sensors_old_8999102 | fkey_from_parent_to_dist_8999100 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999116(measureid) - sensors_old_8999102 | fkey_from_parent_to_parent_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999118(eventdatetime, measureid) - sensors_old_8999102 | fkey_from_parent_to_ref_8999100 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8999104 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) + sensors_2020_01_01_8999104 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) + sensors_2020_01_01_8999104 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) + sensors_2020_01_01_8999104 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999118(eventdatetime, measureid) + sensors_2020_01_01_8999104 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999118(eventdatetime, measureid) + sensors_2020_01_01_8999104 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999116(measureid) + sensors_2020_01_01_8999104 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999116(measureid) + sensors_2020_01_01_8999104 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8999104 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_8999100 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) + sensors_8999100 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) + sensors_8999100 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999118(eventdatetime, measureid) + sensors_8999100 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999116(measureid) + sensors_8999100 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_news_8999106 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) + sensors_news_8999106 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999118(eventdatetime, measureid) + sensors_news_8999106 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999116(measureid) + sensors_news_8999106 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_old_8999102 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) + sensors_old_8999102 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999118(eventdatetime, measureid) + sensors_old_8999102 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999116(measureid) + sensors_old_8999102 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) (22 rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename like '%_89%' ORDER BY 1,2; @@ -706,53 +706,53 @@ SELECT public.wait_for_resource_cleanup(); FROM pg_catalog.pg_class tbl JOIN public.table_fkeys fk on tbl.oid = fk.relid WHERE tbl.relname like '%_89%' - ORDER BY 1, 2; - relname | Constraint | Definition + ORDER BY 1, 3; + relname | Constraint | Definition --------------------------------------------------------------------- - sensors_2020_01_01_8999005 | fkey_from_child_to_child_8999005 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) - sensors_2020_01_01_8999005 | fkey_from_child_to_dist_8999005 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) - sensors_2020_01_01_8999005 | fkey_from_child_to_parent_8999005 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) - sensors_2020_01_01_8999005 | fkey_from_child_to_ref_8999005 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_2020_01_01_8999005 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) - sensors_2020_01_01_8999005 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) - sensors_2020_01_01_8999005 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) - sensors_2020_01_01_8999005 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_2020_01_01_8999005 | sensors_2020_01_01_8999005_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) - sensors_2020_01_01_8999105 | fkey_from_child_to_child_8999105 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) - sensors_2020_01_01_8999105 | fkey_from_child_to_dist_8999105 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999117(measureid) - sensors_2020_01_01_8999105 | fkey_from_child_to_parent_8999105 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999119(eventdatetime, measureid) - sensors_2020_01_01_8999105 | fkey_from_child_to_ref_8999105 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_2020_01_01_8999105 | fkey_from_parent_to_child_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) - sensors_2020_01_01_8999105 | fkey_from_parent_to_dist_8999101 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999117(measureid) - sensors_2020_01_01_8999105 | fkey_from_parent_to_parent_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999119(eventdatetime, measureid) - sensors_2020_01_01_8999105 | fkey_from_parent_to_ref_8999101 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_2020_01_01_8999105 | sensors_2020_01_01_8999105_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) - sensors_8999001 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) - sensors_8999001 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) - sensors_8999001 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) - sensors_8999001 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_8999001 | sensors_8999001_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) - sensors_8999101 | fkey_from_parent_to_child_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) - sensors_8999101 | fkey_from_parent_to_dist_8999101 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999117(measureid) - sensors_8999101 | fkey_from_parent_to_parent_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999119(eventdatetime, measureid) - sensors_8999101 | fkey_from_parent_to_ref_8999101 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_8999101 | sensors_8999101_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) - sensors_news_8999007 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) - sensors_news_8999007 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) - sensors_news_8999007 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) - sensors_news_8999007 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_news_8999107 | fkey_from_parent_to_child_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) - sensors_news_8999107 | fkey_from_parent_to_dist_8999101 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999117(measureid) - sensors_news_8999107 | fkey_from_parent_to_parent_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999119(eventdatetime, measureid) - sensors_news_8999107 | fkey_from_parent_to_ref_8999101 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_old_8999003 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) - sensors_old_8999003 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) - sensors_old_8999003 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) - sensors_old_8999003 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) - sensors_old_8999103 | fkey_from_parent_to_child_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) - sensors_old_8999103 | fkey_from_parent_to_dist_8999101 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999117(measureid) - sensors_old_8999103 | fkey_from_parent_to_parent_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999119(eventdatetime, measureid) - sensors_old_8999103 | fkey_from_parent_to_ref_8999101 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8999005 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8999105 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) + sensors_2020_01_01_8999105 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) + sensors_2020_01_01_8999105 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) + sensors_2020_01_01_8999105 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999119(eventdatetime, measureid) + sensors_2020_01_01_8999105 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999119(eventdatetime, measureid) + sensors_2020_01_01_8999105 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999117(measureid) + sensors_2020_01_01_8999105 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999117(measureid) + sensors_2020_01_01_8999105 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8999105 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_8999001 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_8999001 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_8999001 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) + sensors_8999001 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) + sensors_8999001 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_8999101 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) + sensors_8999101 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) + sensors_8999101 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999119(eventdatetime, measureid) + sensors_8999101 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999117(measureid) + sensors_8999101 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_news_8999007 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_news_8999007 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) + sensors_news_8999007 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) + sensors_news_8999007 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_news_8999107 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) + sensors_news_8999107 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999119(eventdatetime, measureid) + sensors_news_8999107 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999117(measureid) + sensors_news_8999107 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_old_8999003 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_old_8999003 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) + sensors_old_8999003 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) + sensors_old_8999003 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_old_8999103 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) + sensors_old_8999103 | t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999119(eventdatetime, measureid) + sensors_old_8999103 | t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999117(measureid) + sensors_old_8999103 | t | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) (44 rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename like '%_89%' ORDER BY 1,2; diff --git a/src/test/regress/expected/multi_colocated_shard_rebalance.out b/src/test/regress/expected/multi_colocated_shard_rebalance.out index 784202918..976f56f46 100644 --- a/src/test/regress/expected/multi_colocated_shard_rebalance.out +++ b/src/test/regress/expected/multi_colocated_shard_rebalance.out @@ -516,15 +516,18 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.table2_ (2 rows) -- make sure that we've created the foreign keys -SELECT "Constraint", "Definition" FROM table_fkeys - WHERE "Constraint" LIKE 'table2_group%' OR "Constraint" LIKE 'table1_group%'; - Constraint | Definition +SELECT "Constraint", "Definition" +FROM table_fkeys +WHERE relid::regclass::text LIKE 'table2_group%' -- child tables + AND "Definition" LIKE 'FOREIGN KEY (table1_id) REFERENCES table1_group1%' -- referenced parent (and its shards) +ORDER BY 2; + Constraint | Definition --------------------------------------------------------------------- - table2_group1_table1_id_fkey | FOREIGN KEY (table1_id) REFERENCES table1_group1(id) - table2_group1_table1_id_fkey_13000028 | FOREIGN KEY (table1_id) REFERENCES table1_group1_13000022(id) - table2_group1_table1_id_fkey_13000029 | FOREIGN KEY (table1_id) REFERENCES table1_group1_13000023(id) - table2_group1_table1_id_fkey_13000031 | FOREIGN KEY (table1_id) REFERENCES table1_group1_13000025(id) - table2_group1_table1_id_fkey_13000033 | FOREIGN KEY (table1_id) REFERENCES table1_group1_13000027(id) + t | FOREIGN KEY (table1_id) REFERENCES table1_group1(id) + t | FOREIGN KEY (table1_id) REFERENCES table1_group1_13000022(id) + t | FOREIGN KEY (table1_id) REFERENCES table1_group1_13000023(id) + t | FOREIGN KEY (table1_id) REFERENCES table1_group1_13000025(id) + t | FOREIGN KEY (table1_id) REFERENCES table1_group1_13000027(id) (5 rows) \c - - - :master_port diff --git a/src/test/regress/expected/multi_create_table_constraints.out b/src/test/regress/expected/multi_create_table_constraints.out index f4b9fa889..0ea6145ab 100644 --- a/src/test/regress/expected/multi_create_table_constraints.out +++ b/src/test/regress/expected/multi_create_table_constraints.out @@ -453,9 +453,9 @@ SELECT create_distributed_table('raw_table_2', 'user_id'); -- see that the constraint exists SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='raw_table_2'::regclass; - Constraint | Definition + Constraint | Definition --------------------------------------------------------------------- - raw_table_2_user_id_fkey | FOREIGN KEY (user_id) REFERENCES raw_table_1(user_id) + t | FOREIGN KEY (user_id) REFERENCES raw_table_1(user_id) (1 row) -- should be prevented by the foreign key diff --git a/src/test/regress/expected/multi_metadata_sync.out b/src/test/regress/expected/multi_metadata_sync.out index 4ab7a3026..3688c7bf1 100644 --- a/src/test/regress/expected/multi_metadata_sync.out +++ b/src/test/regress/expected/multi_metadata_sync.out @@ -621,7 +621,7 @@ SELECT 1 FROM citus_activate_node('localhost', :worker_1_port); SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='mx_testing_schema_2.fk_test_2'::regclass; Constraint | Definition --------------------------------------------------------------------- - fk_test_2_col1_col2_fkey | FOREIGN KEY (col1, col2) REFERENCES mx_testing_schema.fk_test_1(col1, col3) + t | FOREIGN KEY (col1, col2) REFERENCES mx_testing_schema.fk_test_1(col1, col3) (1 row) \c - - - :master_port @@ -895,7 +895,7 @@ SELECT "Column", "Type", "Definition" FROM index_attrs WHERE SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='mx_test_schema_2.mx_table_2'::regclass; Constraint | Definition --------------------------------------------------------------------- - mx_fk_constraint | FOREIGN KEY (col1) REFERENCES mx_test_schema_1.mx_table_1(col1) + t | FOREIGN KEY (col1) REFERENCES mx_test_schema_1.mx_table_1(col1) (1 row) SELECT create_distributed_table('mx_test_schema_1.mx_table_1', 'col1'); @@ -1071,7 +1071,7 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_test_schema SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='mx_test_schema_1.mx_table_1'::regclass; Constraint | Definition --------------------------------------------------------------------- - mx_fk_constraint | FOREIGN KEY (col1) REFERENCES mx_test_schema_2.mx_table_2(col1) + t | FOREIGN KEY (col1) REFERENCES mx_test_schema_2.mx_table_2(col1) (1 row) -- Check that foreign key constraint with NOT VALID works as well @@ -1090,7 +1090,7 @@ NOT VALID; SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='mx_test_schema_1.mx_table_1'::regclass; Constraint | Definition --------------------------------------------------------------------- - mx_fk_constraint_2 | FOREIGN KEY (col1) REFERENCES mx_test_schema_2.mx_table_2(col1) + t | FOREIGN KEY (col1) REFERENCES mx_test_schema_2.mx_table_2(col1) (1 row) -- Check that update_distributed_table_colocation call propagates the changes to the workers diff --git a/src/test/regress/expected/multi_metadata_sync_0.out b/src/test/regress/expected/multi_metadata_sync_0.out index bc1775ada..34b3fd27e 100644 --- a/src/test/regress/expected/multi_metadata_sync_0.out +++ b/src/test/regress/expected/multi_metadata_sync_0.out @@ -631,7 +631,7 @@ SELECT 1 FROM citus_activate_node('localhost', :worker_1_port); SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='mx_testing_schema_2.fk_test_2'::regclass; Constraint | Definition --------------------------------------------------------------------- - fk_test_2_col1_col2_fkey | FOREIGN KEY (col1, col2) REFERENCES mx_testing_schema.fk_test_1(col1, col3) + t | FOREIGN KEY (col1, col2) REFERENCES mx_testing_schema.fk_test_1(col1, col3) (1 row) \c - - - :master_port @@ -905,7 +905,7 @@ SELECT "Column", "Type", "Definition" FROM index_attrs WHERE SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='mx_test_schema_2.mx_table_2'::regclass; Constraint | Definition --------------------------------------------------------------------- - mx_fk_constraint | FOREIGN KEY (col1) REFERENCES mx_test_schema_1.mx_table_1(col1) + t | FOREIGN KEY (col1) REFERENCES mx_test_schema_1.mx_table_1(col1) (1 row) SELECT create_distributed_table('mx_test_schema_1.mx_table_1', 'col1'); @@ -1081,7 +1081,7 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_test_schema SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='mx_test_schema_1.mx_table_1'::regclass; Constraint | Definition --------------------------------------------------------------------- - mx_fk_constraint | FOREIGN KEY (col1) REFERENCES mx_test_schema_2.mx_table_2(col1) + t | FOREIGN KEY (col1) REFERENCES mx_test_schema_2.mx_table_2(col1) (1 row) -- Check that foreign key constraint with NOT VALID works as well @@ -1100,7 +1100,7 @@ NOT VALID; SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='mx_test_schema_1.mx_table_1'::regclass; Constraint | Definition --------------------------------------------------------------------- - mx_fk_constraint_2 | FOREIGN KEY (col1) REFERENCES mx_test_schema_2.mx_table_2(col1) + t | FOREIGN KEY (col1) REFERENCES mx_test_schema_2.mx_table_2(col1) (1 row) -- Check that update_distributed_table_colocation call propagates the changes to the workers diff --git a/src/test/regress/expected/multi_partitioning.out b/src/test/regress/expected/multi_partitioning.out index 64a4fd4dc..d5f3234cf 100644 --- a/src/test/regress/expected/multi_partitioning.out +++ b/src/test/regress/expected/multi_partitioning.out @@ -693,9 +693,9 @@ INSERT INTO partitioning_test_2009 VALUES(18, '2009-02-01'); ALTER TABLE partitioning_test_2012 ADD CONSTRAINT partitioning_2012_foreign FOREIGN KEY (id) REFERENCES partitioning_test_2009 (id) ON DELETE CASCADE; -- see FOREIGN KEY is created SELECT "Constraint" FROM table_fkeys WHERE relid = 'partitioning_test_2012'::regclass ORDER BY 1; - Constraint + Constraint --------------------------------------------------------------------- - partitioning_2012_foreign + t (1 row) -- test ON DELETE CASCADE works diff --git a/src/test/regress/expected/multi_tenant_isolation.out b/src/test/regress/expected/multi_tenant_isolation.out index 991f09d0f..4fbf33171 100644 --- a/src/test/regress/expected/multi_tenant_isolation.out +++ b/src/test/regress/expected/multi_tenant_isolation.out @@ -1038,50 +1038,50 @@ FROM pg_catalog.pg_class tbl JOIN public.table_fkeys fk on tbl.oid = fk.relid WHERE tbl.relname like 'test_colocated_table_%' ORDER BY 1, 2; - relname | Constraint | Definition + relname | Constraint | Definition --------------------------------------------------------------------- - test_colocated_table_1 | test_colocated_table_1_id_fkey | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1(id) - test_colocated_table_1_1230063 | test_colocated_table_1_id_fkey_1230063 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230063(id) - test_colocated_table_1_1230065 | test_colocated_table_1_id_fkey_1230065 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230065(id) - test_colocated_table_1_1230067 | test_colocated_table_1_id_fkey_1230067 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230067(id) - test_colocated_table_1_1230085 | test_colocated_table_1_id_fkey_1230085 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230085(id) - test_colocated_table_1_1230086 | test_colocated_table_1_id_fkey_1230086 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230086(id) - test_colocated_table_1_1230087 | test_colocated_table_1_id_fkey_1230087 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230087(id) - test_colocated_table_2 | test_colocated_table_2_id_fkey | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1(id) - test_colocated_table_2 | test_colocated_table_2_value_1_fkey | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey(id) - test_colocated_table_2_1230071 | test_colocated_table_2_id_fkey_1230071 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230063(id) - test_colocated_table_2_1230071 | test_colocated_table_2_value_1_fkey_1230071 | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230060(id) - test_colocated_table_2_1230073 | test_colocated_table_2_id_fkey_1230073 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230065(id) - test_colocated_table_2_1230073 | test_colocated_table_2_value_1_fkey_1230073 | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230060(id) - test_colocated_table_2_1230075 | test_colocated_table_2_id_fkey_1230075 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230067(id) - test_colocated_table_2_1230075 | test_colocated_table_2_value_1_fkey_1230075 | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230060(id) - test_colocated_table_2_1230088 | test_colocated_table_2_id_fkey_1230088 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230085(id) - test_colocated_table_2_1230088 | test_colocated_table_2_value_1_fkey_1230088 | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230060(id) - test_colocated_table_2_1230089 | test_colocated_table_2_id_fkey_1230089 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230086(id) - test_colocated_table_2_1230089 | test_colocated_table_2_value_1_fkey_1230089 | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230060(id) - test_colocated_table_2_1230090 | test_colocated_table_2_id_fkey_1230090 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230087(id) - test_colocated_table_2_1230090 | test_colocated_table_2_value_1_fkey_1230090 | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230060(id) - test_colocated_table_3 | test_colocated_table_3_id_fkey | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1(id) - test_colocated_table_3 | test_colocated_table_3_id_fkey1 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_2(id) - test_colocated_table_3 | test_colocated_table_3_value_1_fkey | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey(id) - test_colocated_table_3_1230079 | test_colocated_table_3_id_fkey1_1230079 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_2_1230071(id) - test_colocated_table_3_1230079 | test_colocated_table_3_id_fkey_1230079 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230063(id) - test_colocated_table_3_1230079 | test_colocated_table_3_value_1_fkey_1230079 | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230060(id) - test_colocated_table_3_1230081 | test_colocated_table_3_id_fkey1_1230081 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_2_1230073(id) - test_colocated_table_3_1230081 | test_colocated_table_3_id_fkey_1230081 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230065(id) - test_colocated_table_3_1230081 | test_colocated_table_3_value_1_fkey_1230081 | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230060(id) - test_colocated_table_3_1230083 | test_colocated_table_3_id_fkey1_1230083 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_2_1230075(id) - test_colocated_table_3_1230083 | test_colocated_table_3_id_fkey_1230083 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230067(id) - test_colocated_table_3_1230083 | test_colocated_table_3_value_1_fkey_1230083 | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230060(id) - test_colocated_table_3_1230091 | test_colocated_table_3_id_fkey1_1230091 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_2_1230088(id) - test_colocated_table_3_1230091 | test_colocated_table_3_id_fkey_1230091 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230085(id) - test_colocated_table_3_1230091 | test_colocated_table_3_value_1_fkey_1230091 | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230060(id) - test_colocated_table_3_1230092 | test_colocated_table_3_id_fkey1_1230092 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_2_1230089(id) - test_colocated_table_3_1230092 | test_colocated_table_3_id_fkey_1230092 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230086(id) - test_colocated_table_3_1230092 | test_colocated_table_3_value_1_fkey_1230092 | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230060(id) - test_colocated_table_3_1230093 | test_colocated_table_3_id_fkey1_1230093 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_2_1230090(id) - test_colocated_table_3_1230093 | test_colocated_table_3_id_fkey_1230093 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230087(id) - test_colocated_table_3_1230093 | test_colocated_table_3_value_1_fkey_1230093 | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230060(id) + test_colocated_table_1 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1(id) + test_colocated_table_1_1230063 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230063(id) + test_colocated_table_1_1230065 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230065(id) + test_colocated_table_1_1230067 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230067(id) + test_colocated_table_1_1230085 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230085(id) + test_colocated_table_1_1230086 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230086(id) + test_colocated_table_1_1230087 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230087(id) + test_colocated_table_2 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1(id) + test_colocated_table_2 | t | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey(id) + test_colocated_table_2_1230071 | t | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230060(id) + test_colocated_table_2_1230071 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230063(id) + test_colocated_table_2_1230073 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230065(id) + test_colocated_table_2_1230073 | t | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230060(id) + test_colocated_table_2_1230075 | t | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230060(id) + test_colocated_table_2_1230075 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230067(id) + test_colocated_table_2_1230088 | t | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230060(id) + test_colocated_table_2_1230088 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230085(id) + test_colocated_table_2_1230089 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230086(id) + test_colocated_table_2_1230089 | t | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230060(id) + test_colocated_table_2_1230090 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230087(id) + test_colocated_table_2_1230090 | t | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230060(id) + test_colocated_table_3 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1(id) + test_colocated_table_3 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_2(id) + test_colocated_table_3 | t | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey(id) + test_colocated_table_3_1230079 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230063(id) + test_colocated_table_3_1230079 | t | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230060(id) + test_colocated_table_3_1230079 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_2_1230071(id) + test_colocated_table_3_1230081 | t | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230060(id) + test_colocated_table_3_1230081 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_2_1230073(id) + test_colocated_table_3_1230081 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230065(id) + test_colocated_table_3_1230083 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_2_1230075(id) + test_colocated_table_3_1230083 | t | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230060(id) + test_colocated_table_3_1230083 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230067(id) + test_colocated_table_3_1230091 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230085(id) + test_colocated_table_3_1230091 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_2_1230088(id) + test_colocated_table_3_1230091 | t | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230060(id) + test_colocated_table_3_1230092 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230086(id) + test_colocated_table_3_1230092 | t | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230060(id) + test_colocated_table_3_1230092 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_2_1230089(id) + test_colocated_table_3_1230093 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_2_1230090(id) + test_colocated_table_3_1230093 | t | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230060(id) + test_colocated_table_3_1230093 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230087(id) (42 rows) \c - mx_isolation_role_ent - :master_port diff --git a/src/test/regress/expected/multi_tenant_isolation_nonblocking.out b/src/test/regress/expected/multi_tenant_isolation_nonblocking.out index 0d4ecb1eb..437362e9a 100644 --- a/src/test/regress/expected/multi_tenant_isolation_nonblocking.out +++ b/src/test/regress/expected/multi_tenant_isolation_nonblocking.out @@ -1085,50 +1085,50 @@ FROM pg_catalog.pg_class tbl JOIN public.table_fkeys fk on tbl.oid = fk.relid WHERE tbl.relname like 'test_colocated_table_%' ORDER BY 1, 2; - relname | Constraint | Definition + relname | Constraint | Definition --------------------------------------------------------------------- - test_colocated_table_1 | test_colocated_table_1_id_fkey | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1(id) - test_colocated_table_1_1230068 | test_colocated_table_1_id_fkey_1230068 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230068(id) - test_colocated_table_1_1230070 | test_colocated_table_1_id_fkey_1230070 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230070(id) - test_colocated_table_1_1230072 | test_colocated_table_1_id_fkey_1230072 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230072(id) - test_colocated_table_1_1230098 | test_colocated_table_1_id_fkey_1230098 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230098(id) - test_colocated_table_1_1230099 | test_colocated_table_1_id_fkey_1230099 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230099(id) - test_colocated_table_1_1230100 | test_colocated_table_1_id_fkey_1230100 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230100(id) - test_colocated_table_2 | test_colocated_table_2_id_fkey | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1(id) - test_colocated_table_2 | test_colocated_table_2_value_1_fkey | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey(id) - test_colocated_table_2_1230076 | test_colocated_table_2_id_fkey_1230076 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230068(id) - test_colocated_table_2_1230076 | test_colocated_table_2_value_1_fkey_1230076 | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230065(id) - test_colocated_table_2_1230078 | test_colocated_table_2_id_fkey_1230078 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230070(id) - test_colocated_table_2_1230078 | test_colocated_table_2_value_1_fkey_1230078 | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230065(id) - test_colocated_table_2_1230080 | test_colocated_table_2_id_fkey_1230080 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230072(id) - test_colocated_table_2_1230080 | test_colocated_table_2_value_1_fkey_1230080 | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230065(id) - test_colocated_table_2_1230101 | test_colocated_table_2_id_fkey_1230101 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230098(id) - test_colocated_table_2_1230101 | test_colocated_table_2_value_1_fkey_1230101 | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230065(id) - test_colocated_table_2_1230102 | test_colocated_table_2_id_fkey_1230102 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230099(id) - test_colocated_table_2_1230102 | test_colocated_table_2_value_1_fkey_1230102 | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230065(id) - test_colocated_table_2_1230103 | test_colocated_table_2_id_fkey_1230103 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230100(id) - test_colocated_table_2_1230103 | test_colocated_table_2_value_1_fkey_1230103 | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230065(id) - test_colocated_table_3 | test_colocated_table_3_id_fkey | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1(id) - test_colocated_table_3 | test_colocated_table_3_id_fkey1 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_2(id) - test_colocated_table_3 | test_colocated_table_3_value_1_fkey | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey(id) - test_colocated_table_3_1230084 | test_colocated_table_3_id_fkey1_1230084 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_2_1230076(id) - test_colocated_table_3_1230084 | test_colocated_table_3_id_fkey_1230084 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230068(id) - test_colocated_table_3_1230084 | test_colocated_table_3_value_1_fkey_1230084 | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230065(id) - test_colocated_table_3_1230086 | test_colocated_table_3_id_fkey1_1230086 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_2_1230078(id) - test_colocated_table_3_1230086 | test_colocated_table_3_id_fkey_1230086 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230070(id) - test_colocated_table_3_1230086 | test_colocated_table_3_value_1_fkey_1230086 | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230065(id) - test_colocated_table_3_1230088 | test_colocated_table_3_id_fkey1_1230088 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_2_1230080(id) - test_colocated_table_3_1230088 | test_colocated_table_3_id_fkey_1230088 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230072(id) - test_colocated_table_3_1230088 | test_colocated_table_3_value_1_fkey_1230088 | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230065(id) - test_colocated_table_3_1230104 | test_colocated_table_3_id_fkey1_1230104 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_2_1230101(id) - test_colocated_table_3_1230104 | test_colocated_table_3_id_fkey_1230104 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230098(id) - test_colocated_table_3_1230104 | test_colocated_table_3_value_1_fkey_1230104 | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230065(id) - test_colocated_table_3_1230105 | test_colocated_table_3_id_fkey1_1230105 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_2_1230102(id) - test_colocated_table_3_1230105 | test_colocated_table_3_id_fkey_1230105 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230099(id) - test_colocated_table_3_1230105 | test_colocated_table_3_value_1_fkey_1230105 | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230065(id) - test_colocated_table_3_1230106 | test_colocated_table_3_id_fkey1_1230106 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_2_1230103(id) - test_colocated_table_3_1230106 | test_colocated_table_3_id_fkey_1230106 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230100(id) - test_colocated_table_3_1230106 | test_colocated_table_3_value_1_fkey_1230106 | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230065(id) + test_colocated_table_1 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1(id) + test_colocated_table_1_1230068 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230068(id) + test_colocated_table_1_1230070 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230070(id) + test_colocated_table_1_1230072 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230072(id) + test_colocated_table_1_1230098 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230098(id) + test_colocated_table_1_1230099 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230099(id) + test_colocated_table_1_1230100 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230100(id) + test_colocated_table_2 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1(id) + test_colocated_table_2 | t | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey(id) + test_colocated_table_2_1230076 | t | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230065(id) + test_colocated_table_2_1230076 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230068(id) + test_colocated_table_2_1230078 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230070(id) + test_colocated_table_2_1230078 | t | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230065(id) + test_colocated_table_2_1230080 | t | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230065(id) + test_colocated_table_2_1230080 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230072(id) + test_colocated_table_2_1230101 | t | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230065(id) + test_colocated_table_2_1230101 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230098(id) + test_colocated_table_2_1230102 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230099(id) + test_colocated_table_2_1230102 | t | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230065(id) + test_colocated_table_2_1230103 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230100(id) + test_colocated_table_2_1230103 | t | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230065(id) + test_colocated_table_3 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1(id) + test_colocated_table_3 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_2(id) + test_colocated_table_3 | t | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey(id) + test_colocated_table_3_1230084 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230068(id) + test_colocated_table_3_1230084 | t | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230065(id) + test_colocated_table_3_1230084 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_2_1230076(id) + test_colocated_table_3_1230086 | t | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230065(id) + test_colocated_table_3_1230086 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_2_1230078(id) + test_colocated_table_3_1230086 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230070(id) + test_colocated_table_3_1230088 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_2_1230080(id) + test_colocated_table_3_1230088 | t | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230065(id) + test_colocated_table_3_1230088 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230072(id) + test_colocated_table_3_1230104 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230098(id) + test_colocated_table_3_1230104 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_2_1230101(id) + test_colocated_table_3_1230104 | t | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230065(id) + test_colocated_table_3_1230105 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230099(id) + test_colocated_table_3_1230105 | t | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230065(id) + test_colocated_table_3_1230105 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_2_1230102(id) + test_colocated_table_3_1230106 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_2_1230103(id) + test_colocated_table_3_1230106 | t | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230065(id) + test_colocated_table_3_1230106 | t | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230100(id) (42 rows) \c - mx_isolation_role_ent - :master_port diff --git a/src/test/regress/expected/multi_test_catalog_views.out b/src/test/regress/expected/multi_test_catalog_views.out index 65ca8f637..e4a273ec1 100644 --- a/src/test/regress/expected/multi_test_catalog_views.out +++ b/src/test/regress/expected/multi_test_catalog_views.out @@ -29,14 +29,15 @@ WHERE rc.constraint_schema = kcu.constraint_schema AND rc.unique_constraint_name = uc_kcu.constraint_name; CREATE VIEW table_fkeys AS -SELECT name AS "Constraint", +SELECT TRUE AS "Constraint", format('FOREIGN KEY (%s) REFERENCES %s(%s)', string_agg(DISTINCT quote_ident(column_name), ', '), string_agg(DISTINCT refd_relid::regclass::text, ', '), string_agg(DISTINCT quote_ident(refd_column_name), ', ')) AS "Definition", "relid" FROM table_fkey_cols -GROUP BY (name, relid); +GROUP BY (name, relid) +ORDER BY 1, 3; CREATE VIEW table_attrs AS SELECT c.column_name AS "name", diff --git a/src/test/regress/expected/shard_move_constraints.out b/src/test/regress/expected/shard_move_constraints.out index 72b49f262..f4f44e7d0 100644 --- a/src/test/regress/expected/shard_move_constraints.out +++ b/src/test/regress/expected/shard_move_constraints.out @@ -137,24 +137,24 @@ INSERT INTO sensors SELECT i, '2020-01-05', '{}' FROM generate_series(0,1000)i; SET search_path TO "shard Move Fkeys Indexes", public, pg_catalog; -- show the current state of the constraints SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='sensors_8970000'::regclass ORDER BY 1,2; - Constraint | Definition + Constraint | Definition --------------------------------------------------------------------- - fkey_from_parent_to_child_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) - fkey_from_parent_to_dist_8970000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970016(measureid) - fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) - sensors_8970000_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) + t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970016(measureid) (4 rows) SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='sensors_2020_01_01_8970008'::regclass ORDER BY 1,2; - Constraint | Definition + Constraint | Definition --------------------------------------------------------------------- - fkey_from_child_to_child_8970008 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) - fkey_from_child_to_dist_8970008 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970016(measureid) - fkey_from_child_to_parent_8970008 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) - fkey_from_parent_to_child_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) - fkey_from_parent_to_dist_8970000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970016(measureid) - fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) - sensors_2020_01_01_8970008_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) + t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970016(measureid) + t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970016(measureid) (7 rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename ='sensors_8970000' ORDER BY 1,2; @@ -232,24 +232,24 @@ SELECT public.wait_for_resource_cleanup(); \c - postgres - :worker_2_port SET search_path TO "shard Move Fkeys Indexes", public, pg_catalog; SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='sensors_8970000'::regclass ORDER BY 1,2; - Constraint | Definition + Constraint | Definition --------------------------------------------------------------------- - fkey_from_parent_to_child_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) - fkey_from_parent_to_dist_8970000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970016(measureid) - fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) - sensors_8970000_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) + t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970016(measureid) (4 rows) SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='sensors_2020_01_01_8970008'::regclass ORDER BY 1,2; - Constraint | Definition + Constraint | Definition --------------------------------------------------------------------- - fkey_from_child_to_child_8970008 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) - fkey_from_child_to_dist_8970008 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970016(measureid) - fkey_from_child_to_parent_8970008 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) - fkey_from_parent_to_child_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) - fkey_from_parent_to_dist_8970000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970016(measureid) - fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) - sensors_2020_01_01_8970008_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) + t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970016(measureid) + t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970016(measureid) (7 rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename ='sensors_8970000' ORDER BY 1,2; diff --git a/src/test/regress/expected/shard_move_constraints_blocking.out b/src/test/regress/expected/shard_move_constraints_blocking.out index 5f1b91cb6..2a49d34b4 100644 --- a/src/test/regress/expected/shard_move_constraints_blocking.out +++ b/src/test/regress/expected/shard_move_constraints_blocking.out @@ -133,27 +133,27 @@ INSERT INTO sensors SELECT i, '2020-01-05', '{}' FROM generate_series(0,1000)i; SET search_path TO "blocking shard Move Fkeys Indexes", public, pg_catalog; -- show the current state of the constraints SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='sensors_8970000'::regclass ORDER BY 1,2; - Constraint | Definition + Constraint | Definition --------------------------------------------------------------------- - fkey_from_parent_to_child_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) - fkey_from_parent_to_dist_8970000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970016(measureid) - fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) - fkey_from_parent_to_ref_8970000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970028(measureid) - sensors_8970000_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) + t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970016(measureid) + t | FOREIGN KEY (measureid) REFERENCES reference_table_8970028(measureid) (5 rows) SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='sensors_2020_01_01_8970008'::regclass ORDER BY 1,2; - Constraint | Definition + Constraint | Definition --------------------------------------------------------------------- - fkey_from_child_to_child_8970008 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) - fkey_from_child_to_dist_8970008 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970016(measureid) - fkey_from_child_to_parent_8970008 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) - fkey_from_child_to_ref_8970008 | FOREIGN KEY (measureid) REFERENCES reference_table_8970028(measureid) - fkey_from_parent_to_child_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) - fkey_from_parent_to_dist_8970000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970016(measureid) - fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) - fkey_from_parent_to_ref_8970000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970028(measureid) - sensors_2020_01_01_8970008_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) + t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970016(measureid) + t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970016(measureid) + t | FOREIGN KEY (measureid) REFERENCES reference_table_8970028(measureid) + t | FOREIGN KEY (measureid) REFERENCES reference_table_8970028(measureid) (9 rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename ='sensors_8970000' ORDER BY 1,2; @@ -231,27 +231,27 @@ SELECT public.wait_for_resource_cleanup(); \c - postgres - :worker_2_port SET search_path TO "blocking shard Move Fkeys Indexes", public, pg_catalog; SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='sensors_8970000'::regclass ORDER BY 1,2; - Constraint | Definition + Constraint | Definition --------------------------------------------------------------------- - fkey_from_parent_to_child_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) - fkey_from_parent_to_dist_8970000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970016(measureid) - fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) - fkey_from_parent_to_ref_8970000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970028(measureid) - sensors_8970000_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) + t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970016(measureid) + t | FOREIGN KEY (measureid) REFERENCES reference_table_8970028(measureid) (5 rows) SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='sensors_2020_01_01_8970008'::regclass ORDER BY 1,2; - Constraint | Definition + Constraint | Definition --------------------------------------------------------------------- - fkey_from_child_to_child_8970008 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) - fkey_from_child_to_dist_8970008 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970016(measureid) - fkey_from_child_to_parent_8970008 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) - fkey_from_child_to_ref_8970008 | FOREIGN KEY (measureid) REFERENCES reference_table_8970028(measureid) - fkey_from_parent_to_child_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) - fkey_from_parent_to_dist_8970000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970016(measureid) - fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) - fkey_from_parent_to_ref_8970000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970028(measureid) - sensors_2020_01_01_8970008_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) + t | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) + t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970016(measureid) + t | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970016(measureid) + t | FOREIGN KEY (measureid) REFERENCES reference_table_8970028(measureid) + t | FOREIGN KEY (measureid) REFERENCES reference_table_8970028(measureid) (9 rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename ='sensors_8970000' ORDER BY 1,2; diff --git a/src/test/regress/sql/citus_non_blocking_split_columnar.sql b/src/test/regress/sql/citus_non_blocking_split_columnar.sql index 5b0665060..8a8870332 100644 --- a/src/test/regress/sql/citus_non_blocking_split_columnar.sql +++ b/src/test/regress/sql/citus_non_blocking_split_columnar.sql @@ -138,7 +138,7 @@ SELECT pg_reload_conf(); FROM pg_catalog.pg_class tbl JOIN public.table_fkeys fk on tbl.oid = fk.relid WHERE tbl.relname like '%_89%' - ORDER BY 1, 2; + ORDER BY 1, 3; SELECT tablename, indexdef FROM pg_indexes WHERE tablename like '%_89%' ORDER BY 1,2; SELECT stxname FROM pg_statistic_ext WHERE stxnamespace IN ( @@ -155,7 +155,7 @@ SELECT pg_reload_conf(); FROM pg_catalog.pg_class tbl JOIN public.table_fkeys fk on tbl.oid = fk.relid WHERE tbl.relname like '%_89%' - ORDER BY 1, 2; + ORDER BY 1, 3; SELECT tablename, indexdef FROM pg_indexes WHERE tablename like '%_89%' ORDER BY 1,2; SELECT stxname FROM pg_statistic_ext WHERE stxnamespace IN ( @@ -209,7 +209,7 @@ SELECT public.wait_for_resource_cleanup(); FROM pg_catalog.pg_class tbl JOIN public.table_fkeys fk on tbl.oid = fk.relid WHERE tbl.relname like '%_89%' - ORDER BY 1, 2; + ORDER BY 1, 3; SELECT tablename, indexdef FROM pg_indexes WHERE tablename like '%_89%' ORDER BY 1,2; SELECT stxname FROM pg_statistic_ext WHERE stxnamespace IN ( @@ -226,7 +226,7 @@ SELECT public.wait_for_resource_cleanup(); FROM pg_catalog.pg_class tbl JOIN public.table_fkeys fk on tbl.oid = fk.relid WHERE tbl.relname like '%_89%' - ORDER BY 1, 2; + ORDER BY 1, 3; SELECT tablename, indexdef FROM pg_indexes WHERE tablename like '%_89%' ORDER BY 1,2; SELECT stxname FROM pg_statistic_ext WHERE stxnamespace IN ( @@ -280,7 +280,7 @@ SELECT public.wait_for_resource_cleanup(); FROM pg_catalog.pg_class tbl JOIN public.table_fkeys fk on tbl.oid = fk.relid WHERE tbl.relname like '%_89%' - ORDER BY 1, 2; + ORDER BY 1, 3; SELECT tablename, indexdef FROM pg_indexes WHERE tablename like '%_89%' ORDER BY 1,2; SELECT stxname FROM pg_statistic_ext WHERE stxnamespace IN ( @@ -297,7 +297,7 @@ SELECT public.wait_for_resource_cleanup(); FROM pg_catalog.pg_class tbl JOIN public.table_fkeys fk on tbl.oid = fk.relid WHERE tbl.relname like '%_89%' - ORDER BY 1, 2; + ORDER BY 1, 3; SELECT tablename, indexdef FROM pg_indexes WHERE tablename like '%_89%' ORDER BY 1,2; SELECT stxname FROM pg_statistic_ext WHERE stxnamespace IN ( diff --git a/src/test/regress/sql/citus_split_shard_columnar_partitioned.sql b/src/test/regress/sql/citus_split_shard_columnar_partitioned.sql index bee287293..3723547a3 100644 --- a/src/test/regress/sql/citus_split_shard_columnar_partitioned.sql +++ b/src/test/regress/sql/citus_split_shard_columnar_partitioned.sql @@ -134,7 +134,7 @@ SELECT pg_reload_conf(); FROM pg_catalog.pg_class tbl JOIN public.table_fkeys fk on tbl.oid = fk.relid WHERE tbl.relname like '%_89%' - ORDER BY 1, 2; + ORDER BY 1, 3; SELECT tablename, indexdef FROM pg_indexes WHERE tablename like '%_89%' ORDER BY 1,2; SELECT stxname FROM pg_statistic_ext WHERE stxnamespace IN ( @@ -151,7 +151,7 @@ SELECT pg_reload_conf(); FROM pg_catalog.pg_class tbl JOIN public.table_fkeys fk on tbl.oid = fk.relid WHERE tbl.relname like '%_89%' - ORDER BY 1, 2; + ORDER BY 1, 3; SELECT tablename, indexdef FROM pg_indexes WHERE tablename like '%_89%' ORDER BY 1,2; SELECT stxname FROM pg_statistic_ext WHERE stxnamespace IN ( @@ -205,7 +205,7 @@ SELECT public.wait_for_resource_cleanup(); FROM pg_catalog.pg_class tbl JOIN public.table_fkeys fk on tbl.oid = fk.relid WHERE tbl.relname like '%_89%' - ORDER BY 1, 2; + ORDER BY 1, 3; SELECT tablename, indexdef FROM pg_indexes WHERE tablename like '%_89%' ORDER BY 1,2; SELECT stxname FROM pg_statistic_ext WHERE stxnamespace IN ( @@ -222,7 +222,7 @@ SELECT public.wait_for_resource_cleanup(); FROM pg_catalog.pg_class tbl JOIN public.table_fkeys fk on tbl.oid = fk.relid WHERE tbl.relname like '%_89%' - ORDER BY 1, 2; + ORDER BY 1, 3; SELECT tablename, indexdef FROM pg_indexes WHERE tablename like '%_89%' ORDER BY 1,2; SELECT stxname FROM pg_statistic_ext WHERE stxnamespace IN ( @@ -276,7 +276,7 @@ SELECT public.wait_for_resource_cleanup(); FROM pg_catalog.pg_class tbl JOIN public.table_fkeys fk on tbl.oid = fk.relid WHERE tbl.relname like '%_89%' - ORDER BY 1, 2; + ORDER BY 1, 3; SELECT tablename, indexdef FROM pg_indexes WHERE tablename like '%_89%' ORDER BY 1,2; SELECT stxname FROM pg_statistic_ext WHERE stxnamespace IN ( @@ -293,7 +293,7 @@ SELECT public.wait_for_resource_cleanup(); FROM pg_catalog.pg_class tbl JOIN public.table_fkeys fk on tbl.oid = fk.relid WHERE tbl.relname like '%_89%' - ORDER BY 1, 2; + ORDER BY 1, 3; SELECT tablename, indexdef FROM pg_indexes WHERE tablename like '%_89%' ORDER BY 1,2; SELECT stxname FROM pg_statistic_ext WHERE stxnamespace IN ( diff --git a/src/test/regress/sql/multi_colocated_shard_rebalance.sql b/src/test/regress/sql/multi_colocated_shard_rebalance.sql index c22af2cc7..8b2a0e269 100644 --- a/src/test/regress/sql/multi_colocated_shard_rebalance.sql +++ b/src/test/regress/sql/multi_colocated_shard_rebalance.sql @@ -263,8 +263,11 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.table1_ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.table2_group1_13000028'::regclass; -- make sure that we've created the foreign keys -SELECT "Constraint", "Definition" FROM table_fkeys - WHERE "Constraint" LIKE 'table2_group%' OR "Constraint" LIKE 'table1_group%'; +SELECT "Constraint", "Definition" +FROM table_fkeys +WHERE relid::regclass::text LIKE 'table2_group%' -- child tables + AND "Definition" LIKE 'FOREIGN KEY (table1_id) REFERENCES table1_group1%' -- referenced parent (and its shards) +ORDER BY 2; \c - - - :master_port diff --git a/src/test/regress/sql/multi_test_catalog_views.sql b/src/test/regress/sql/multi_test_catalog_views.sql index 249b2d274..4771b0cfa 100644 --- a/src/test/regress/sql/multi_test_catalog_views.sql +++ b/src/test/regress/sql/multi_test_catalog_views.sql @@ -30,14 +30,15 @@ WHERE rc.constraint_schema = kcu.constraint_schema AND rc.unique_constraint_name = uc_kcu.constraint_name; CREATE VIEW table_fkeys AS -SELECT name AS "Constraint", +SELECT TRUE AS "Constraint", format('FOREIGN KEY (%s) REFERENCES %s(%s)', string_agg(DISTINCT quote_ident(column_name), ', '), string_agg(DISTINCT refd_relid::regclass::text, ', '), string_agg(DISTINCT quote_ident(refd_column_name), ', ')) AS "Definition", "relid" FROM table_fkey_cols -GROUP BY (name, relid); +GROUP BY (name, relid) +ORDER BY 1, 3; CREATE VIEW table_attrs AS SELECT c.column_name AS "name",