pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: Daniel Gustafsson <daniel@yesql.se>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: allow trigger to get updated columns
Date: Tue, 21 Jan 2025 18:19:51 -0500
Message-ID: <3496294.1737501591@sss.pgh.pa.us> (raw)
In-Reply-To: <4e534c8d-4c04-6a30-e8e9-aecdec917ccc@2ndquadrant.com>
References: <11c5f156-67a9-0fb5-8200-2a8018eb2e0c@2ndquadrant.com>
	<CEA65957-59AA-4BEA-AD33-5334EAC3E34C@yesql.se>
	<4e534c8d-4c04-6a30-e8e9-aecdec917ccc@2ndquadrant.com>

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





view thread (5+ messages)  latest in thread

Message-ID: <3496294.1737501591@sss.pgh.pa.us>
Permalink:  ../3496294.1737501591@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3496294.1737501591@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, peter@eisentraut.org, daniel@yesql.se
  Subject: Re: allow trigger to get updated columns
  In-Reply-To: <3496294.1737501591@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox