Re: Rename of triggers for partitioned tables

From: David Steele <david(at)pgmasters(dot)net>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Arne Roland <A(dot)Roland(at)index(dot)de>
Cc: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Rename of triggers for partitioned tables
Date: 2021-03-18 15:50:37
Message-ID: 0e245ca1-bb16-2416-a9cb-7255907227d7@pgmasters.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 1/15/21 5:26 PM, Alvaro Herrera wrote:
> On 2020-Nov-27, Arne Roland wrote:
>
>> I got too annoyed at building queries for gexec all the time. So wrote
>> a patch to fix the issue that the rename of partitioned trigger
>> doesn't affect children.
>
> As you say, triggers on children don't necessarily have to have the same
> name as on parent; this already happens when the trigger is renamed in
> the child table but not on parent. In that situation the search on the
> child will fail, which will cause the whole thing to fail I think.
>
> We now have the column pg_trigger.tgparentid, and I think it would be
> better (more reliable) to search for the trigger in the child by the
> tgparentid column instead, rather than by name.
>
> Also, I think it would be good to have
> ALTER TRIGGER .. ON ONLY parent RENAME TO ..
> to avoid recursing to children. This seems mostly pointless, but since
> we've allowed changing the name of the trigger in children thus far,
> then we've implicitly made it supported to have triggers that are named
> differently. (And it's not entirely academic, since the trigger name
> determines firing order.)
>
> Alternatively to this last point, we could decide to disallow renaming
> of triggers on children (i.e. if trigger has tgparentid set, then
> renaming is disallowed). I don't have a problem with that, but it would
> have to be an explicit decision to take.

Arne, thoughts on Álvaro's comments?

Marking this patch as Waiting for Author.

Regards,
--
-David
david(at)pgmasters(dot)net

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vik Fearing 2021-03-18 16:03:34 Re: Implement <null treatment> for window functions
Previous Message Dmitry Dolgov 2021-03-18 15:50:02 Re: pg_stat_statements and "IN" conditions