Merge pull request #1246 from citusdata/disallow_master_appy_delete_on_hash

Disallow master_apply_delete_command on hash distributed table
pull/1237/merge
Burak Velioglu 2017-02-24 10:47:49 +02:00 committed by GitHub
commit 424745a49a
2 changed files with 11 additions and 10 deletions

View File

@ -145,12 +145,14 @@ master_apply_delete_command(PG_FUNCTION_ARGS)
deleteCriteria = eval_const_expressions(NULL, whereClause);
partitionMethod = PartitionMethod(relationId);
if ((partitionMethod == DISTRIBUTE_BY_HASH) && (deleteCriteria != NULL))
if (partitionMethod == DISTRIBUTE_BY_HASH)
{
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot delete from distributed table"),
errmsg("cannot delete from hash distributed table with this "
"command"),
errdetail("Delete statements on hash-partitioned tables "
"with where clause is not supported")));
"are not supported with master_apply_delete_command."),
errhint("Use master_modify_multiple_shards command instead.")));
}
else if (partitionMethod == DISTRIBUTE_BY_NONE)
{

View File

@ -55,15 +55,14 @@ EXECUTE sharded_query;
-- try to drop shards with where clause
SELECT master_apply_delete_command('DELETE FROM sharded_table WHERE id > 0');
ERROR: cannot delete from distributed table
DETAIL: Delete statements on hash-partitioned tables with where clause is not supported
ERROR: cannot delete from hash distributed table with this command
DETAIL: Delete statements on hash-partitioned tables are not supported with master_apply_delete_command.
HINT: Use master_modify_multiple_shards command instead.
-- drop all shards
SELECT master_apply_delete_command('DELETE FROM sharded_table');
master_apply_delete_command
-----------------------------
2
(1 row)
ERROR: cannot delete from hash distributed table with this command
DETAIL: Delete statements on hash-partitioned tables are not supported with master_apply_delete_command.
HINT: Use master_modify_multiple_shards command instead.
-- lock shard metadata: take some share locks and exclusive locks
BEGIN;
SELECT lock_shard_metadata(5, ARRAY[999001, 999002, 999002]);