Assert(HeapTupleIsValid(fdw_trigtuple) ^ ItemPointerIsValid(tupleid));
if (fdw_trigtuple == NULL)
{
- TupleTableSlot *newSlot;
+ TupleTableSlot *epqslot_candidate = NULL;
if (!GetTupleForTrigger(estate, epqstate, relinfo, tupleid,
- LockTupleExclusive, slot, &newSlot))
+ LockTupleExclusive, slot, &epqslot_candidate))
return false;
/*
* function requested for the updated tuple, skip the trigger
* execution.
*/
- if (newSlot != NULL && epqslot != NULL)
+ if (epqslot_candidate != NULL && epqslot != NULL)
{
- *epqslot = newSlot;
+ *epqslot = epqslot_candidate;
return false;
}
Assert(HeapTupleIsValid(fdw_trigtuple) ^ ItemPointerIsValid(tupleid));
if (fdw_trigtuple == NULL)
{
- TupleTableSlot *newSlot = NULL;
+ TupleTableSlot *epqslot_candidate = NULL;
/* get a copy of the on-disk tuple we are planning to update */
if (!GetTupleForTrigger(estate, epqstate, relinfo, tupleid,
- lockmode, oldslot, &newSlot))
+ lockmode, oldslot, &epqslot_candidate))
return false; /* cancel the update action */
/*
* nor our caller have any more interest in the prior contents of that
* slot.
*/
- if (newSlot != NULL)
+ if (epqslot_candidate != NULL)
{
- TupleTableSlot *slot = ExecFilterJunk(relinfo->ri_junkFilter, newSlot);
+ TupleTableSlot *epqslot_clean;
- ExecCopySlot(newslot, slot);
+ epqslot_clean = ExecFilterJunk(relinfo->ri_junkFilter, epqslot_candidate);
+
+ if (newslot != epqslot_clean)
+ ExecCopySlot(newslot, epqslot_clean);
}
trigtuple = ExecFetchSlotHeapTuple(oldslot, true, &should_free_trig);
ItemPointer tid,
LockTupleMode lockmode,
TupleTableSlot *oldslot,
- TupleTableSlot **newSlot)
+ TupleTableSlot **epqslot)
{
Relation relation = relinfo->ri_RelationDesc;
- if (newSlot != NULL)
+ if (epqslot != NULL)
{
TM_Result test;
TM_FailureData tmfd;
int lockflags = 0;
- *newSlot = NULL;
+ *epqslot = NULL;
/* caller must pass an epqstate if EvalPlanQual is possible */
Assert(epqstate != NULL);
case TM_Ok:
if (tmfd.traversed)
{
- TupleTableSlot *epqslot;
-
- epqslot = EvalPlanQual(epqstate,
- relation,
- relinfo->ri_RangeTableIndex,
- oldslot);
+ *epqslot = EvalPlanQual(epqstate,
+ relation,
+ relinfo->ri_RangeTableIndex,
+ oldslot);
/*
* If PlanQual failed for updated tuple - we must not
* process this tuple!
*/
- if (TupIsNull(epqslot))
+ if (TupIsNull(*epqslot))
+ {
+ *epqslot = NULL;
return false;
-
- *newSlot = epqslot;
+ }
}
break;