Fix possible corruption of AfterTriggerEventLists in subtransaction rollback.
authorTom Lane <[email protected]>
Thu, 19 Aug 2010 15:46:30 +0000 (15:46 +0000)
committerTom Lane <[email protected]>
Thu, 19 Aug 2010 15:46:30 +0000 (15:46 +0000)
commitfd91b7d39aae5a02cfedf89da5f4589cfef2082e
tree88dd40c28b96e5a773335107e0ceb4fec021205f
parent8a288694f52d3f8a717ca7f1aa19a56b11e19232
Fix possible corruption of AfterTriggerEventLists in subtransaction rollback.

afterTriggerInvokeEvents failed to adjust events->tailfree when truncating
the last chunk of an event list.  This could result in the data being
"de-truncated" by afterTriggerRestoreEventList during a subsequent
subtransaction abort.  Even that wouldn't kill us, because the re-added data
would just be events marked DONE --- unless the data had been partially
overwritten by new events.  Then we might crash, or in any case misbehave
(perhaps fire triggers twice, or fire triggers with the wrong event data).
Per bug #5622 from Thue Janus Kristensen.

Back-patch to 8.4 where the current trigger list representation was introduced.
src/backend/commands/trigger.c