mirror of https://github.com/citusdata/citus.git
Use rte->updatedCols to determine if partition column exists
Use rte->updatedCols to determine if partition column exists in the target list in case of UPDATE. Commit on PG: 86dc90056dfdbd9d1b891718d2e5614e3e432f35pg14_support_after_rebase
parent
9d73845580
commit
84b1f74939
|
@ -641,9 +641,26 @@ ModifyPartialQuerySupported(Query *queryTree, bool multiShardQuery,
|
||||||
{
|
{
|
||||||
targetEntryPartitionColumn = false;
|
targetEntryPartitionColumn = false;
|
||||||
}
|
}
|
||||||
else if (targetEntry->resno == partitionColumn->varattno)
|
else
|
||||||
{
|
{
|
||||||
targetEntryPartitionColumn = true;
|
if (commandType == CMD_UPDATE) {
|
||||||
|
/*
|
||||||
|
* For
|
||||||
|
*/
|
||||||
|
RangeTblEntry* resultRTE = ExtractResultRelationRTE(queryTree);
|
||||||
|
/*
|
||||||
|
* FirstLowInvalidHeapAttributeNumber is added as an offset to rte->updatedCols.
|
||||||
|
* So we substract that to get the column no for an updated column that matches
|
||||||
|
* resultRTE->updatedcols.
|
||||||
|
*/
|
||||||
|
int updatedColNoWithOffset = partitionColumn->varattno - FirstLowInvalidHeapAttributeNumber;
|
||||||
|
if (bms_is_member(updatedColNoWithOffset, resultRTE->updatedCols)) {
|
||||||
|
targetEntryPartitionColumn = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}else if (targetEntry->resno == partitionColumn->varattno) {
|
||||||
|
targetEntryPartitionColumn = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* skip resjunk entries: UPDATE adds some for ctid, etc. */
|
/* skip resjunk entries: UPDATE adds some for ctid, etc. */
|
||||||
|
@ -662,6 +679,8 @@ ModifyPartialQuerySupported(Query *queryTree, bool multiShardQuery,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO:: targetEntry->resno is wrong here, we SHOULD think about
|
||||||
|
//TargetEntryChangesValue for update case based on 86dc90056dfdbd9d1b891718d2e5614e3e432f35.
|
||||||
if (commandType == CMD_UPDATE && targetEntryPartitionColumn &&
|
if (commandType == CMD_UPDATE && targetEntryPartitionColumn &&
|
||||||
TargetEntryChangesValue(targetEntry, partitionColumn,
|
TargetEntryChangesValue(targetEntry, partitionColumn,
|
||||||
queryTree->jointree))
|
queryTree->jointree))
|
||||||
|
|
Loading…
Reference in New Issue