OSDN Git Service

Fix possible corruption of AfterTriggerEventLists in subtransaction rollback.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 19 Aug 2010 15:46:24 +0000 (15:46 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 19 Aug 2010 15:46:24 +0000 (15:46 +0000)
commit780a7dcb69bd9f48dc4656861ff6c75843544eb7
tree7f3ed795afcb6a5d9f74d36d37d92b88409ee376
parent205fc921d727dbe547c6306ee0368f4b2a54d3aa
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