]> granicus.if.org Git - postgresql/commit
Add missing buffer lock acquisition in GetTupleForTrigger().
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 30 Nov 2012 18:56:00 +0000 (13:56 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 30 Nov 2012 18:56:00 +0000 (13:56 -0500)
commit1c316e3a02e7eb8aaf8e04a441fc176aef06e317
treef75c9d944c66784f4bcea2adeb2bbf7c6189c62a
parent2c55189b2b9e71a14bba1496da6be84614595983
Add missing buffer lock acquisition in GetTupleForTrigger().

If we had not been holding buffer pin continuously since the tuple was
initially fetched by the UPDATE or DELETE query, it would be possible for
VACUUM or a page-prune operation to move the tuple while we're trying to
copy it.  This would result in a garbage "old" tuple value being passed to
an AFTER ROW UPDATE or AFTER ROW DELETE trigger.  The preconditions for
this are somewhat improbable, and the timing constraints are very tight;
so it's not so surprising that this hasn't been reported from the field,
even though the bug has been there a long time.

Problem found by Andres Freund.  Back-patch to all active branches.
src/backend/commands/trigger.c