mirror of https://github.com/citusdata/citus.git
Prevent undistribute_table calls for partitions
parent
feca381500
commit
85a4b61a0e
|
@ -1592,6 +1592,16 @@ UndistributeTable(Oid relationId)
|
|||
"because it is a foreign table.")));
|
||||
}
|
||||
|
||||
if (PartitionTable(relationId))
|
||||
{
|
||||
Oid parentRelationId = PartitionParentOid(relationId);
|
||||
char *parentRelationName = get_rel_name(parentRelationId);
|
||||
ereport(ERROR, (errmsg("Cannot undistribute table "
|
||||
"because it is a partition."),
|
||||
errhint("Undistribute the partitioned table \"%s\" instead.",
|
||||
parentRelationName)));
|
||||
}
|
||||
|
||||
List *preLoadCommands = GetPreLoadTableCreationCommands(relationId, true);
|
||||
List *postLoadCommands = GetPostLoadTableCreationCommands(relationId);
|
||||
|
||||
|
|
|
@ -194,6 +194,11 @@ SELECT * FROM partitioned_table_6_10 ORDER BY 1, 2;
|
|||
7 | 2
|
||||
(1 row)
|
||||
|
||||
-- undistributing partitions are not supported
|
||||
SELECT undistribute_table('partitioned_table_1_5');
|
||||
ERROR: Cannot undistribute table because it is a partition.
|
||||
HINT: Undistribute the partitioned table "partitioned_table" instead.
|
||||
-- we can undistribute partitioned parent tables
|
||||
SELECT undistribute_table('partitioned_table');
|
||||
NOTICE: Undistributing the partitions of undistribute_table.partitioned_table
|
||||
NOTICE: Creating a new local table for undistribute_table.partitioned_table_1_5
|
||||
|
|
|
@ -77,6 +77,9 @@ SELECT * FROM partitioned_table ORDER BY 1, 2;
|
|||
SELECT * FROM partitioned_table_1_5 ORDER BY 1, 2;
|
||||
SELECT * FROM partitioned_table_6_10 ORDER BY 1, 2;
|
||||
|
||||
-- undistributing partitions are not supported
|
||||
SELECT undistribute_table('partitioned_table_1_5');
|
||||
-- we can undistribute partitioned parent tables
|
||||
SELECT undistribute_table('partitioned_table');
|
||||
|
||||
SELECT logicalrelid FROM pg_dist_partition WHERE logicalrelid::regclass::text LIKE 'partitioned\_table%' ORDER BY 1;
|
||||
|
|
Loading…
Reference in New Issue