Re: allow trigger to get updated columns
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: Daniel Gustafsson <daniel@yesql.se>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-01-21T23:19:51Z
Lists: pgsql-hackers
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes: > On 2020-03-05 13:53, Daniel Gustafsson wrote: >> +1 on the patchset, marking this entry as Ready For Committer. > and done While looking at a pending patch, I happened to notice that commit 71d60e2aa added a field ats_modifiedcols to AfterTriggerSharedData, but did not change the logic in afterTriggerAddEvent that decides whether the new event's evtshared matches some existing one. Thus, we could seize on a pre-existing entry that matches in everything except ats_modifiedcols, resulting in ultimately firing the trigger with the wrong modifiedcols information. If this is not in fact completely broken, the reason must be that ats_modifiedcols will always be the same for the same values of ats_tgoid/ats_relid/ats_event/ats_table (within a given transaction). That seems unlikely, although if it were true we could perhaps put the data somewhere else instead of bloating AfterTriggerSharedData. The obvious fix would involve adding a bms_equal() call to the comparison loop in afterTriggerAddEvent, which makes me quite sad on performance grounds. Maybe it hardly matters in the big scheme of things, though. regards, tom lane
Commits
-
Repair incorrect handling of AfterTriggerSharedData.ats_modifiedcols.
- ea68ea6320ff 18.0 landed
- cdeed4de7729 15.11 landed
- 8c57f548534b 16.7 landed
- 30859930528b 14.16 landed
- 2b72fed2dd74 17.3 landed
- 001c09d8b72e 13.19 landed
-
Add tg_updatedcols to TriggerData
- 71d60e2aa051 13.0 landed
-
Code simplification
- 8f152b6c50c7 13.0 landed