mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-30 14:31:40 +02:00
Remove field UpdateContext->updated in nodeModifyTable.c
This field has been redundant ever since it was added by commit
25e777cf8e
, which split up ExecUpdate() and ExecDelete() into reusable
pieces. The only place that reads it is ExecMergeMatched(), if the
result from ExecUpdateAct() is TM_Ok. However, all paths through
ExecUpdateAct() that return TM_Ok also set this field to true, so the
return status by itself is sufficient to tell if the update happened.
Removing this field is a modest simplification, and it brings the
UPDATE path in ExecMergeMatched() more into line with ExecUpdate(),
ensuring that ExecUpdateEpilogue() is always called if ExecUpdateAct()
returns TM_Ok, reducing the chance of bugs.
Dean Rasheed, reviewed by Alvaro Herrera.
Discussion: https://postgr.es/m/CAEZATCWGGmigGBzLHkJm5Ccv2mMxXmwi3%2Buq0yhwDHm-tsvSLg%40mail.gmail.com
This commit is contained in:
parent
6fd144e3a9
commit
362de947cd
@ -109,7 +109,6 @@ typedef struct ModifyTableContext
|
|||||||
*/
|
*/
|
||||||
typedef struct UpdateContext
|
typedef struct UpdateContext
|
||||||
{
|
{
|
||||||
bool updated; /* did UPDATE actually occur? */
|
|
||||||
bool crossPartUpdate; /* was it a cross-partition update? */
|
bool crossPartUpdate; /* was it a cross-partition update? */
|
||||||
TU_UpdateIndexes updateIndexes; /* Which index updates are required? */
|
TU_UpdateIndexes updateIndexes; /* Which index updates are required? */
|
||||||
|
|
||||||
@ -2042,7 +2041,6 @@ lreplace:
|
|||||||
&insert_destrel))
|
&insert_destrel))
|
||||||
{
|
{
|
||||||
/* success! */
|
/* success! */
|
||||||
updateCxt->updated = true;
|
|
||||||
updateCxt->crossPartUpdate = true;
|
updateCxt->crossPartUpdate = true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2111,8 +2109,6 @@ lreplace:
|
|||||||
true /* wait for commit */ ,
|
true /* wait for commit */ ,
|
||||||
&context->tmfd, &updateCxt->lockmode,
|
&context->tmfd, &updateCxt->lockmode,
|
||||||
&updateCxt->updateIndexes);
|
&updateCxt->updateIndexes);
|
||||||
if (result == TM_Ok)
|
|
||||||
updateCxt->updated = true;
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -2919,7 +2915,7 @@ lmerge_matched:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == TM_Ok && updateCxt.updated)
|
if (result == TM_Ok)
|
||||||
{
|
{
|
||||||
ExecUpdateEpilogue(context, &updateCxt, resultRelInfo,
|
ExecUpdateEpilogue(context, &updateCxt, resultRelInfo,
|
||||||
tupleid, NULL, newslot);
|
tupleid, NULL, newslot);
|
||||||
|
Loading…
Reference in New Issue
Block a user