pgsql: I found a corner case in which it is possible for RI_FKey_check's - Mailing list pgsql-committers

From tgl@svr1.postgresql.org (Tom Lane)
Subject pgsql: I found a corner case in which it is possible for RI_FKey_check's
Date
Msg-id 20041030205308.88AD63A3F87@svr1.postgresql.org
Whole thread Raw
List pgsql-committers
Log Message:
-----------
I found a corner case in which it is possible for RI_FKey_check's call
of HeapTupleSatisfiesItself() to trigger a hint-bit update on the tuple:
if the row was updated or deleted by a subtransaction of my own transaction
that was later rolled back.  This cannot occur in pre-8.0 of course, so
the hint-bit patch applied a couple weeks ago is OK for existing releases.
But for 8.0 it seems we had better fix things so that RI_FKey_check can
pass the correct buffer number to HeapTupleSatisfiesItself.  Accordingly,
add fields to the TriggerData struct to carry the buffer ID(s) for the
old and new tuple(s).  There are other possible solutions but this one
seems cleanest; it will allow other AFTER-trigger functions to safely
do tqual.c calls if they want to.  Put new fields at end of struct so
that there is no API breakage.

Modified Files:
--------------
    pgsql/doc/src/sgml:
        trigger.sgml (r1.36 -> r1.37)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/trigger.sgml.diff?r1=1.36&r2=1.37)
    pgsql/src/backend/commands:
        tablecmds.c (r1.137 -> r1.138)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/tablecmds.c.diff?r1=1.137&r2=1.138)
        trigger.c (r1.173 -> r1.174)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/trigger.c.diff?r1=1.173&r2=1.174)
    pgsql/src/backend/utils/adt:
        ri_triggers.c (r1.74 -> r1.75)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/ri_triggers.c.diff?r1=1.74&r2=1.75)
    pgsql/src/include/commands:
        trigger.h (r1.49 -> r1.50)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/commands/trigger.h.diff?r1=1.49&r2=1.50)

pgsql-committers by date:

Previous
From: tgl@svr1.postgresql.org (Tom Lane)
Date:
Subject: pgsql: Change COMMIT back to the old behavior of emitting command tag
Next
From: tgl@svr1.postgresql.org (Tom Lane)
Date:
Subject: pgsql: Invent a new, more thread-safe version of PQrequestCancel, called