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

From: tgl(at)svr1(dot)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: I found a corner case in which it is possible for RI_FKey_check's
Date: 2004-10-30 20:53:08
Message-ID: 20041030205308.88AD63A3F87@svr1.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2004-10-30 23:12:06 pgsql: Invent a new, more thread-safe version of PQrequestCancel, called
Previous Message Tom Lane 2004-10-30 20:44:44 pgsql: Change COMMIT back to the old behavior of emitting command tag