Re: BUG #17817: DISABLE TRIGGER ALL on a partitioned table with foreign key fails

Alvaro Herrera <alvherre@alvh.no-ip.org>

From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: ahodgson@simkin.ca, pgsql-bugs@lists.postgresql.org
Date: 2023-03-03T18:17:35Z
Lists: pgsql-bugs
On 2023-Mar-03, Tom Lane wrote:

> I wrote:
> > I can throw together a patch for what I was thinking of.
> 
> Basically just make the recursive steps match on tgparentid instead
> of name, like this.

Thank you, looks sane to me.

> I wonder whether anyplace else is making a similar mistake?  Although
> there's not much we will let you do to a foreign key trigger, so it
> might not matter for anything else.

Right ... triggers created in the normal way would have matching names,
so the previous code would work correctly.

I wonder how come this problem took so long to be detected with Ruby on
Rails; it's been in released 13.x and 14.x for seven months now.  I
suppose it would be very useful if the Ruby on Rails community would run
their tests more often on new Postgres versions (or even on the tip of
stable branches).

-- 
Álvaro Herrera        Breisgau, Deutschland  —  https://www.EnterpriseDB.com/
Y una voz del caos me habló y me dijo
"Sonríe y sé feliz, podría ser peor".
Y sonreí. Y fui feliz.
Y fue peor.



Commits

  1. Avoid failure when altering state of partitioned foreign-key triggers.

  2. Fix ENABLE/DISABLE TRIGGER to handle recursion correctly