Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lQmTI-0003uL-18 for pgsql-hackers@arkaria.postgresql.org; Mon, 29 Mar 2021 07:38:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lQmTG-0008Te-CP for pgsql-hackers@arkaria.postgresql.org; Mon, 29 Mar 2021 07:37:58 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lQmTG-0008TW-1y for pgsql-hackers@lists.postgresql.org; Mon, 29 Mar 2021 07:37:58 +0000 Received: from mxout4.routing.net ([2a03:2900:1:a::9]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lQmTE-0008AS-7Q for pgsql-hackers@lists.postgresql.org; Mon, 29 Mar 2021 07:37:57 +0000 Received: from mxbox3.masterlogin.de (unknown [192.168.10.78]) by mxout4.routing.net (Postfix) with ESMTP id 57A97100770; Mon, 29 Mar 2021 07:37:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailerdienst.de; s=20200217; t=1617003474; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=i8yozLtXct1tZ98n/7cPTfktmXc/algKn/6PWO2jm4U=; b=fj4SpstWe39xysrdsHMe0hn7EbLYSdpAhFzD7V5bN8MFx6d9NeFRdDvmX1SOKaOZ5z5ZO+ Bo/GZ5DNHLXeWbhSwk5f3wLq9VYtRYeIzwhK6Gg/1o1IBgUssYNSDvpS0FzWkwQ3Nh/BtS bieAfI6pBmM8EELRsD0i6SkVTo8iOaU= Received: from remote.index.de (business-90-187-114-221.pool2.vodafone-ip.de [90.187.114.221]) by mxbox3.masterlogin.de (Postfix) with ESMTPSA id C4066360594; Mon, 29 Mar 2021 07:37:53 +0000 (UTC) Received: from acedia.index-gruppe.local (192.168.3.121) by acedia.index-gruppe.local (192.168.3.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 29 Mar 2021 09:37:53 +0200 Received: from acedia.index-gruppe.local ([fe80::ecd1:5d0a:a834:dd56]) by acedia.index-gruppe.local ([fe80::ecd1:5d0a:a834:dd56%5]) with mapi id 15.01.2176.009; Mon, 29 Mar 2021 09:37:53 +0200 From: Arne Roland To: David Steele , Alvaro Herrera CC: Pg Hackers Subject: Re: Rename of triggers for partitioned tables Thread-Topic: Rename of triggers for partitioned tables Thread-Index: AQHWxEk1+rora/wutkWbcRQhC03q0KnbGQ2sgAAECBOATmSTgIBhAeKAgBDG6bM= Date: Mon, 29 Mar 2021 07:37:53 +0000 Message-ID: <63c8be480eda4ef28d17a019e79841e2@index.de> References: <20210115222641.GA26284@alvherre.pgsql>,<0e245ca1-bb16-2416-a9cb-7255907227d7@pgmasters.net> In-Reply-To: <0e245ca1-bb16-2416-a9cb-7255907227d7@pgmasters.net> Accept-Language: en-US, de-DE Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.255.1.33] Content-Type: multipart/alternative; boundary="_000_63c8be480eda4ef28d17a019e79841e2indexde_" MIME-Version: 1.0 X-Mail-ID: 02ff268a-d4a9-4279-b815-c0ccbd20028e List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --_000_63c8be480eda4ef28d17a019e79841e2indexde_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable David Steele wrote: > Arne, thoughts on =C1lvaro's comments? > > Marking this patch as Waiting for Author. Thank you for the reminder. I was to absorbed by other tasks. I should be m= ore present in the upcoming weeks. > I think you did not register the patch in commitfest, so I did that for > you: https://commitfest.postgresql.org/32/2943/ Thank you! I should have done that. > 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. The last patch already checks tgparentid and errors out if either of those = do not match. The reasoning behind that was, that I don't see a clear reasonable way to h= andle this scenario. If the user choose to rename the child trigger, I am at a loss what to do. I thought to pass it back to the user to solve the situation instead of sim= ply ignoring the users earlier rename. Silently renaming sounded a bit presumptuous to me, even though I don't car= e that much either way. Do you think silently renaming is better than yielding an error? > 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.) If it would be entirely academic, I wouldn't have noticed the whole thing i= n the first place. The on only variant sounds like a good idea to me. Even though hardly worth= any efford, it seems simple enough. I will work on that. > 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. I rejected that idea, because I was unsure what to do with migrations. If w= e would be discussing this a few years back, this would have been likely my= vote, but I don't see it happening now. Regards Arne --_000_63c8be480eda4ef28d17a019e79841e2indexde_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
David Steele wrote:
> Arne, thoughts on =C1lvaro's comments?
>
> Marking this patch as Waiting for Author.

Thank you for the reminder. I was to absorbed by other tasks. I should be m= ore present in the upcoming weeks.

> I think you did not register the patch in commitfest, so I did that fo= r
> you: https://commitfest.postgresql.org/32/2943/

Thank you! I should have done that.

> As you say, triggers on children don't necessarily have to have the sa= me
> 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<= br> > better (more reliable) to search for the trigger in the child by the > tgparentid column instead, rather than by name.

The last patch already checks tgparentid and errors out if either of those = do not match.
The reasoning behind that was, that I don't see a clear reasonable way to h= andle this scenario.
If the user choose to rename the child trigger, I am at a loss what to do.<= br> I thought to pass it back to the user to solve the situation instead of sim= ply ignoring the users earlier rename.
Silently renaming sounded a bit presumptuous to me, even though I don't car= e that much either way.

Do you think silently renaming is better than yielding an error?

> 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 name= d
> differently.  (And it's not entirely academic, since the trigger = name
> determines firing order.)

If it would be entirely academic, I wouldn't have noticed the whole thing i= n the first place.

The on only variant sounds like a good idea to me. Even though hardly worth= any efford, it seems simple enough. I will work on that.

> 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 i= t would
> have to be an explicit decision to take.

I rejected that idea, because I was unsure what to do with migrations. If w= e would be discussing this a few years back, this would have been likely my= vote, but I don't see it happening now.

Regards
Arne

--_000_63c8be480eda4ef28d17a019e79841e2indexde_--