mirror of https://github.com/citusdata/citus.git
This commit adds a safety-net to the issue seen in #6785. The fix for the underlying issue will be in the PR#6943
parent
d99a5e2f62
commit
f9dbe7784b
|
@ -1906,19 +1906,38 @@ RouterJob(Query *originalQuery, PlannerRestrictionContext *plannerRestrictionCon
|
||||||
{
|
{
|
||||||
RangeTblEntry *updateOrDeleteOrMergeRTE = ExtractResultRelationRTE(originalQuery);
|
RangeTblEntry *updateOrDeleteOrMergeRTE = ExtractResultRelationRTE(originalQuery);
|
||||||
|
|
||||||
/*
|
|
||||||
* If all of the shards are pruned, we replace the relation RTE into
|
|
||||||
* subquery RTE that returns no results. However, this is not useful
|
|
||||||
* for UPDATE and DELETE queries. Therefore, if we detect a UPDATE or
|
|
||||||
* DELETE RTE with subquery type, we just set task list to empty and return
|
|
||||||
* the job.
|
|
||||||
*/
|
|
||||||
if (updateOrDeleteOrMergeRTE->rtekind == RTE_SUBQUERY)
|
if (updateOrDeleteOrMergeRTE->rtekind == RTE_SUBQUERY)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* Not generating tasks for MERGE target relation might
|
||||||
|
* result in incorrect behavior as source rows with NOT
|
||||||
|
* MATCHED clause might qualify for insertion.
|
||||||
|
*/
|
||||||
|
if (IsMergeQuery(originalQuery))
|
||||||
|
{
|
||||||
|
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||||
|
errmsg("Merge command is currently "
|
||||||
|
"unsupported with filters that "
|
||||||
|
"prunes down to zero shards"),
|
||||||
|
errhint("Avoid `WHERE false` clause or "
|
||||||
|
"any equivalent filters that "
|
||||||
|
"could prune down to zero shards")));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* If all of the shards are pruned, we replace the
|
||||||
|
* relation RTE into subquery RTE that returns no
|
||||||
|
* results. However, this is not useful for UPDATE
|
||||||
|
* and DELETE queries. Therefore, if we detect a
|
||||||
|
* UPDATE or DELETE RTE with subquery type, we just
|
||||||
|
* set task list to empty and return the job.
|
||||||
|
*/
|
||||||
job->taskList = NIL;
|
job->taskList = NIL;
|
||||||
return job;
|
return job;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isMultiShardModifyQuery)
|
if (isMultiShardModifyQuery)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue