ResultRelInfo *partrelinfo_new;
Relation partrel_new;
bool found;
+ EPQState epqstate;
/* Get the matching local tuple from the partition. */
found = FindReplTupleInLocalRel(edata, partrel,
newtup);
MemoryContextSwitchTo(oldctx);
+ EvalPlanQualInit(&epqstate, estate, NULL, NIL, -1, NIL);
+ ExecOpenIndices(partrelinfo, false);
+
/*
* Does the updated tuple still satisfy the current
* partition's constraint?
* work already done above to find the local tuple in the
* partition.
*/
- EPQState epqstate;
-
- EvalPlanQualInit(&epqstate, estate, NULL, NIL, -1, NIL);
- ExecOpenIndices(partrelinfo, false);
-
EvalPlanQualSetSlot(&epqstate, remoteslot_part);
TargetPrivilegesCheck(partrelinfo->ri_RelationDesc,
ACL_UPDATE);
ExecSimpleRelationUpdate(partrelinfo, estate, &epqstate,
localslot, remoteslot_part);
- ExecCloseIndices(partrelinfo);
- EvalPlanQualEnd(&epqstate);
}
else
{
RelationGetRelationName(partrel_new));
/* DELETE old tuple found in the old partition. */
- apply_handle_delete_internal(edata, partrelinfo,
- localslot,
- part_entry->localindexoid);
+ EvalPlanQualSetSlot(&epqstate, localslot);
+ TargetPrivilegesCheck(partrelinfo->ri_RelationDesc, ACL_DELETE);
+ ExecSimpleRelationDelete(partrelinfo, estate, &epqstate, localslot);
/* INSERT new tuple into the new partition. */
apply_handle_insert_internal(edata, partrelinfo_new,
remoteslot_part);
}
+
+ ExecCloseIndices(partrelinfo);
+ EvalPlanQualEnd(&epqstate);
}
break;