mirror of https://github.com/citusdata/citus.git
Merge pull request #1246 from citusdata/disallow_master_appy_delete_on_hash
Disallow master_apply_delete_command on hash distributed tablepull/1237/merge
commit
424745a49a
|
@ -145,12 +145,14 @@ master_apply_delete_command(PG_FUNCTION_ARGS)
|
||||||
deleteCriteria = eval_const_expressions(NULL, whereClause);
|
deleteCriteria = eval_const_expressions(NULL, whereClause);
|
||||||
|
|
||||||
partitionMethod = PartitionMethod(relationId);
|
partitionMethod = PartitionMethod(relationId);
|
||||||
if ((partitionMethod == DISTRIBUTE_BY_HASH) && (deleteCriteria != NULL))
|
if (partitionMethod == DISTRIBUTE_BY_HASH)
|
||||||
{
|
{
|
||||||
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
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 "
|
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)
|
else if (partitionMethod == DISTRIBUTE_BY_NONE)
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,15 +55,14 @@ EXECUTE sharded_query;
|
||||||
|
|
||||||
-- try to drop shards with where clause
|
-- try to drop shards with where clause
|
||||||
SELECT master_apply_delete_command('DELETE FROM sharded_table WHERE id > 0');
|
SELECT master_apply_delete_command('DELETE FROM sharded_table WHERE id > 0');
|
||||||
ERROR: cannot delete from distributed table
|
ERROR: cannot delete from hash distributed table with this command
|
||||||
DETAIL: Delete statements on hash-partitioned tables with where clause is not supported
|
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
|
-- drop all shards
|
||||||
SELECT master_apply_delete_command('DELETE FROM sharded_table');
|
SELECT master_apply_delete_command('DELETE FROM sharded_table');
|
||||||
master_apply_delete_command
|
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.
|
||||||
2
|
HINT: Use master_modify_multiple_shards command instead.
|
||||||
(1 row)
|
|
||||||
|
|
||||||
-- lock shard metadata: take some share locks and exclusive locks
|
-- lock shard metadata: take some share locks and exclusive locks
|
||||||
BEGIN;
|
BEGIN;
|
||||||
SELECT lock_shard_metadata(5, ARRAY[999001, 999002, 999002]);
|
SELECT lock_shard_metadata(5, ARRAY[999001, 999002, 999002]);
|
||||||
|
|
Loading…
Reference in New Issue