Add test dropping object after dropping table

velioglu/temp_two_pro
Burak Velioglu 2022-01-30 22:00:20 +03:00
parent 105f136b64
commit adc71b38ed
No known key found for this signature in database
GPG Key ID: F6827E620F6549C6
2 changed files with 46 additions and 0 deletions

View File

@ -416,6 +416,40 @@ SELECT * FROM run_command_on_workers($$SELECT * FROM (SELECT pg_identify_object_
localhost | 57638 | t | (extension,{ltree},{})
(2 rows)
-- Show that dropping a distributed table drops the pg_dist_object entry on worker
CREATE TABLE extension_schema.table_to_check_object(id int);
SELECT create_distributed_table('extension_schema.table_to_check_object', 'id');
create_distributed_table
---------------------------------------------------------------------
(1 row)
SELECT * FROM (SELECT pg_identify_object_as_address(classid, objid, objsubid) as obj_identifier from citus.pg_dist_object) as obj_identifiers where obj_identifier::text like '%table_to_check_object%';
obj_identifier
---------------------------------------------------------------------
(table,"{extension_schema,table_to_check_object}",{})
(1 row)
SELECT * FROM run_command_on_workers($$SELECT * FROM (SELECT pg_identify_object_as_address(classid, objid, objsubid) as obj_identifier from citus.pg_dist_object) as obj_identifiers where obj_identifier::text like '%table_to_check_object%';$$) ORDER BY 1,2;
nodename | nodeport | success | result
---------------------------------------------------------------------
localhost | 57637 | t | (table,"{extension_schema,table_to_check_object}",{})
localhost | 57638 | t | (table,"{extension_schema,table_to_check_object}",{})
(2 rows)
DROP TABLE extension_schema.table_to_check_object;
SELECT * FROM (SELECT pg_identify_object_as_address(classid, objid, objsubid) as obj_identifier from citus.pg_dist_object) as obj_identifiers where obj_identifier::text like '%table_to_check_object%';
obj_identifier
---------------------------------------------------------------------
(0 rows)
SELECT * FROM run_command_on_workers($$SELECT * FROM (SELECT pg_identify_object_as_address(classid, objid, objsubid) as obj_identifier from citus.pg_dist_object) as obj_identifiers where obj_identifier::text like '%table_to_check_object%';$$) ORDER BY 1,2;
nodename | nodeport | success | result
---------------------------------------------------------------------
localhost | 57637 | t |
localhost | 57638 | t |
(2 rows)
-- Revert the settings for following tests
RESET citus.enable_ddl_propagation;
RESET citus.shard_replication_factor;

View File

@ -177,6 +177,18 @@ SELECT * FROM run_command_on_workers($$SELECT * FROM (SELECT pg_identify_object_
SELECT * FROM (SELECT pg_identify_object_as_address(classid, objid, objsubid) as obj_identifier from citus.pg_dist_object) as obj_identifiers where obj_identifier::text like '%{ltree}%';
SELECT * FROM run_command_on_workers($$SELECT * FROM (SELECT pg_identify_object_as_address(classid, objid, objsubid) as obj_identifier from citus.pg_dist_object) as obj_identifiers where obj_identifier::text like '%{ltree}%';$$) ORDER BY 1,2;
-- Show that dropping a distributed table drops the pg_dist_object entry on worker
CREATE TABLE extension_schema.table_to_check_object(id int);
SELECT create_distributed_table('extension_schema.table_to_check_object', 'id');
SELECT * FROM (SELECT pg_identify_object_as_address(classid, objid, objsubid) as obj_identifier from citus.pg_dist_object) as obj_identifiers where obj_identifier::text like '%table_to_check_object%';
SELECT * FROM run_command_on_workers($$SELECT * FROM (SELECT pg_identify_object_as_address(classid, objid, objsubid) as obj_identifier from citus.pg_dist_object) as obj_identifiers where obj_identifier::text like '%table_to_check_object%';$$) ORDER BY 1,2;
DROP TABLE extension_schema.table_to_check_object;
SELECT * FROM (SELECT pg_identify_object_as_address(classid, objid, objsubid) as obj_identifier from citus.pg_dist_object) as obj_identifiers where obj_identifier::text like '%table_to_check_object%';
SELECT * FROM run_command_on_workers($$SELECT * FROM (SELECT pg_identify_object_as_address(classid, objid, objsubid) as obj_identifier from citus.pg_dist_object) as obj_identifiers where obj_identifier::text like '%table_to_check_object%';$$) ORDER BY 1,2;
-- Revert the settings for following tests
RESET citus.enable_ddl_propagation;
RESET citus.shard_replication_factor;