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,17 +1906,36 @@ RouterJob(Query *originalQuery, PlannerRestrictionContext *plannerRestrictionCon
|
|||
{
|
||||
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)
|
||||
{
|
||||
job->taskList = NIL;
|
||||
return job;
|
||||
/*
|
||||
* 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;
|
||||
return job;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue