mirror of
https://github.com/postgres/postgres.git
synced 2025-04-20 00:42:27 +03:00
Revert 764da7710b
Discussion: https://postgr.es/m/20230323003003.plgaxjqahjgkuxrk%40awork3.anarazel.de
This commit is contained in:
parent
2b65bf046d
commit
b0b91ced16
@ -1559,22 +1559,6 @@ ldelete:
|
|||||||
{
|
{
|
||||||
case TM_Ok:
|
case TM_Ok:
|
||||||
Assert(context->tmfd.traversed);
|
Assert(context->tmfd.traversed);
|
||||||
|
|
||||||
/*
|
|
||||||
* Save locked tuple for further processing of
|
|
||||||
* RETURNING clause.
|
|
||||||
*/
|
|
||||||
if (processReturning &&
|
|
||||||
resultRelInfo->ri_projectReturning &&
|
|
||||||
!resultRelInfo->ri_FdwRoutine)
|
|
||||||
{
|
|
||||||
TupleTableSlot *returningSlot;
|
|
||||||
|
|
||||||
returningSlot = ExecGetReturningSlot(estate, resultRelInfo);
|
|
||||||
ExecCopySlot(returningSlot, inputslot);
|
|
||||||
ExecMaterializeSlot(returningSlot);
|
|
||||||
}
|
|
||||||
|
|
||||||
epqslot = EvalPlanQual(context->epqstate,
|
epqslot = EvalPlanQual(context->epqstate,
|
||||||
resultRelationDesc,
|
resultRelationDesc,
|
||||||
resultRelInfo->ri_RangeTableIndex,
|
resultRelInfo->ri_RangeTableIndex,
|
||||||
@ -1689,17 +1673,12 @@ ldelete:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* Tuple can be already fetched to the returning slot in case
|
|
||||||
* we've previously locked it. Fetch the tuple only if the slot
|
|
||||||
* is empty.
|
|
||||||
*/
|
|
||||||
slot = ExecGetReturningSlot(estate, resultRelInfo);
|
slot = ExecGetReturningSlot(estate, resultRelInfo);
|
||||||
if (oldtuple != NULL)
|
if (oldtuple != NULL)
|
||||||
{
|
{
|
||||||
ExecForceStoreHeapTuple(oldtuple, slot, false);
|
ExecForceStoreHeapTuple(oldtuple, slot, false);
|
||||||
}
|
}
|
||||||
else if (TupIsNull(slot))
|
else
|
||||||
{
|
{
|
||||||
if (!table_tuple_fetch_row_version(resultRelationDesc, tupleid,
|
if (!table_tuple_fetch_row_version(resultRelationDesc, tupleid,
|
||||||
SnapshotAny, slot))
|
SnapshotAny, slot))
|
||||||
@ -2414,19 +2393,6 @@ redo_act:
|
|||||||
case TM_Ok:
|
case TM_Ok:
|
||||||
Assert(context->tmfd.traversed);
|
Assert(context->tmfd.traversed);
|
||||||
|
|
||||||
/* Make sure ri_oldTupleSlot is initialized. */
|
|
||||||
if (unlikely(!resultRelInfo->ri_projectNewInfoValid))
|
|
||||||
ExecInitUpdateProjection(context->mtstate,
|
|
||||||
resultRelInfo);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Save the locked tuple for further calculation
|
|
||||||
* of the new tuple.
|
|
||||||
*/
|
|
||||||
oldSlot = resultRelInfo->ri_oldTupleSlot;
|
|
||||||
ExecCopySlot(oldSlot, inputslot);
|
|
||||||
ExecMaterializeSlot(oldSlot);
|
|
||||||
|
|
||||||
epqslot = EvalPlanQual(context->epqstate,
|
epqslot = EvalPlanQual(context->epqstate,
|
||||||
resultRelationDesc,
|
resultRelationDesc,
|
||||||
resultRelInfo->ri_RangeTableIndex,
|
resultRelInfo->ri_RangeTableIndex,
|
||||||
@ -2435,6 +2401,18 @@ redo_act:
|
|||||||
/* Tuple not passing quals anymore, exiting... */
|
/* Tuple not passing quals anymore, exiting... */
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
/* Make sure ri_oldTupleSlot is initialized. */
|
||||||
|
if (unlikely(!resultRelInfo->ri_projectNewInfoValid))
|
||||||
|
ExecInitUpdateProjection(context->mtstate,
|
||||||
|
resultRelInfo);
|
||||||
|
|
||||||
|
/* Fetch the most recent version of old tuple. */
|
||||||
|
oldSlot = resultRelInfo->ri_oldTupleSlot;
|
||||||
|
if (!table_tuple_fetch_row_version(resultRelationDesc,
|
||||||
|
tupleid,
|
||||||
|
SnapshotAny,
|
||||||
|
oldSlot))
|
||||||
|
elog(ERROR, "failed to fetch tuple being updated");
|
||||||
slot = ExecGetUpdateNewTuple(resultRelInfo,
|
slot = ExecGetUpdateNewTuple(resultRelInfo,
|
||||||
epqslot, oldSlot);
|
epqslot, oldSlot);
|
||||||
goto redo_act;
|
goto redo_act;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user