Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 614d951

Browse files
committed
In SELECT FOR UPDATE, silently ignore null CTIDs, rather than generating
an error as we used to. In an OUTER JOIN scenario, retrieving a null CTID from one of the input relations is entirely expected. We still want to lock the input rows from the other relations, so just ignore the null and keep going.
1 parent 981a7d3 commit 614d951

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/backend/executor/execMain.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*
2828
*
2929
* IDENTIFICATION
30-
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.132 2000/11/12 00:36:57 tgl Exp $
30+
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.133 2000/12/05 22:03:57 tgl Exp $
3131
*
3232
*-------------------------------------------------------------------------
3333
*/
@@ -994,6 +994,7 @@ lnext: ;
994994
&isNull))
995995
elog(ERROR, "ExecutePlan: NO (junk) `ctid' was found!");
996996

997+
/* shouldn't ever get a null result... */
997998
if (isNull)
998999
elog(ERROR, "ExecutePlan: (junk) `ctid' is NULL!");
9991000

@@ -1023,9 +1024,13 @@ lnext: ;
10231024
elog(ERROR, "ExecutePlan: NO (junk) `%s' was found!",
10241025
erm->resname);
10251026

1027+
/*
1028+
* Unlike the UPDATE/DELETE case, a null result is
1029+
* possible here, when the referenced table is on the
1030+
* nullable side of an outer join. Ignore nulls.
1031+
*/
10261032
if (isNull)
1027-
elog(ERROR, "ExecutePlan: (junk) `%s' is NULL!",
1028-
erm->resname);
1033+
continue;
10291034

10301035
tuple.t_self = *((ItemPointer) DatumGetPointer(datum));
10311036
test = heap_mark4update(erm->relation, &tuple, &buffer);
@@ -1038,11 +1043,8 @@ lnext: ;
10381043

10391044
case HeapTupleUpdated:
10401045
if (XactIsoLevel == XACT_SERIALIZABLE)
1041-
{
10421046
elog(ERROR, "Can't serialize access due to concurrent update");
1043-
return (NULL);
1044-
}
1045-
else if (!(ItemPointerEquals(&(tuple.t_self),
1047+
if (!(ItemPointerEquals(&(tuple.t_self),
10461048
(ItemPointer) DatumGetPointer(datum))))
10471049
{
10481050
newSlot = EvalPlanQual(estate, erm->rti, &(tuple.t_self));

0 commit comments

Comments
 (0)