Merge pull request #2088 from citusdata/fix-drop-partitioning-table-from-worker

Prevent DROPping partitioned tables from workers
pull/2013/head
Burak Yücesoy 2018-04-09 14:37:03 +03:00 committed by GitHub
commit 3873d6858d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 0 deletions

View File

@ -3813,6 +3813,8 @@ ProcessDropTableStmt(DropStmt *dropTableStatement)
continue;
}
EnsureCoordinator();
partitionList = PartitionList(relationId);
if (list_length(partitionList) == 0)
{

View File

@ -241,6 +241,10 @@ SELECT inhrelid::regclass FROM pg_inherits WHERE inhparent = 'partitioning_test'
partitioning_test_2013
(4 rows)
-- make sure DROPping from worker node is not allowed
DROP TABLE partitioning_test;
ERROR: operation is not allowed on this node
HINT: Connect to the coordinator and run it again.
\c - - - :master_port
-- make sure we can repeatedly call start_metadata_sync_to_node
SELECT start_metadata_sync_to_node('localhost', :worker_1_port);

View File

@ -205,6 +205,9 @@ SELECT inhrelid::regclass FROM pg_inherits WHERE inhparent = 'partitioning_test'
ERROR: relation "partitioning_test" does not exist
LINE 1: ...elid::regclass FROM pg_inherits WHERE inhparent = 'partition...
^
-- make sure DROPping from worker node is not allowed
DROP TABLE partitioning_test;
ERROR: table "partitioning_test" does not exist
\c - - - :master_port
-- make sure we can repeatedly call start_metadata_sync_to_node
SELECT start_metadata_sync_to_node('localhost', :worker_1_port);

View File

@ -156,6 +156,9 @@ ALTER TABLE partitioning_test DETACH PARTITION partitioning_test_2009;
SELECT inhrelid::regclass FROM pg_inherits WHERE inhparent = 'partitioning_test'::regclass;
-- make sure DROPping from worker node is not allowed
DROP TABLE partitioning_test;
\c - - - :master_port
-- make sure we can repeatedly call start_metadata_sync_to_node