Revert&Fix citus_local_tables.sql

talha_tes1
Ahmet Gedemenli 2021-10-20 19:00:54 +03:00
parent ecd8dd2465
commit 561948d7d4
3 changed files with 36 additions and 0 deletions

View File

@ -416,6 +416,29 @@ SELECT create_reference_table('dummy_reference_table');
(1 row)
BEGIN;
SET client_min_messages TO ERROR;
SELECT remove_local_tables_from_metadata();
remove_local_tables_from_metadata
---------------------------------------------------------------------
(1 row)
-- should see only citus local tables that are not converted automatically
SELECT logicalrelid::regclass::text FROM pg_dist_partition, pg_tables
WHERE tablename=logicalrelid::regclass::text AND
schemaname='citus_local_tables_test_schema' AND
partmethod = 'n' AND repmodel = 's'
ORDER BY 1;
logicalrelid
---------------------------------------------------------------------
citus_local_table_1
citus_local_table_2
local_table_3
unlogged_table
(4 rows)
ROLLBACK;
-- define foreign keys between dummy_reference_table and citus local tables
-- not to undistribute them automatically
ALTER TABLE citus_local_table_1 ADD CONSTRAINT fkey_to_dummy_ref FOREIGN KEY (a) REFERENCES dummy_reference_table(a);

View File

@ -24,3 +24,4 @@ SELECT * FROM master_get_active_worker_nodes();
localhost | 57638
localhost | 57637
(2 rows)

View File

@ -313,6 +313,18 @@ SET search_path TO citus_local_tables_test_schema;
CREATE TABLE dummy_reference_table (a INT PRIMARY KEY);
SELECT create_reference_table('dummy_reference_table');
BEGIN;
SET client_min_messages TO ERROR;
SELECT remove_local_tables_from_metadata();
-- should see only citus local tables that are not converted automatically
SELECT logicalrelid::regclass::text FROM pg_dist_partition, pg_tables
WHERE tablename=logicalrelid::regclass::text AND
schemaname='citus_local_tables_test_schema' AND
partmethod = 'n' AND repmodel = 's'
ORDER BY 1;
ROLLBACK;
-- define foreign keys between dummy_reference_table and citus local tables
-- not to undistribute them automatically
ALTER TABLE citus_local_table_1 ADD CONSTRAINT fkey_to_dummy_ref FOREIGN KEY (a) REFERENCES dummy_reference_table(a);