Re: Rename of triggers for partitioned tables

2021-07-26 Thread Arne Roland
From: Tom Lane Sent: Monday, July 26, 2021 19:38 To: Alvaro Herrera Subject: Re: Rename of triggers for partitioned tables > Yeah, we don't support partial indexes on catalogs, and this example > doesn't make me feel like we ought to open that can of worms. I asked why such

Re: Rename of triggers for partitioned tables

2021-07-26 Thread Tom Lane
Alvaro Herrera writes: > Arne complained that there should be a unique constraint on (tgrelid, > tgparentid) which would sidestep the need for this to be a loop. I > don't think it's really necessary, and I'm not sure how to create a > system index WHERE tgparentid <> 0. Yeah, we don't support p

Re: Rename of triggers for partitioned tables

2021-07-26 Thread Alvaro Herrera
On 2021-Jul-25, Tom Lane wrote: > Perhaps there's no actual bug there, but it's still horrible coding. > For one thing, the implication that found could be negative is extremely > confusing to readers. A boolean might be better. However, I wonder why > you bothered with a flag in the first place

Re: Rename of triggers for partitioned tables

2021-07-25 Thread Tom Lane
Alvaro Herrera writes: > I pushed this patch with some minor corrections (mostly improved the > message wording.) Coverity does not like this bit, and I fully agree: /srv/coverity/git/pgsql-git/postgresql/src/backend/commands/trigger.c: 1639 in renametrig_partition() >>> CID 1489387: Incor

Re: Rename of triggers for partitioned tables

2021-07-22 Thread Alvaro Herrera
On 2021-Jul-22, Alvaro Herrera wrote: > I pushed this patch with some minor corrections (mostly improved the > message wording.) Hmm, the sorting fails for Czech or something like that. Will fix ... -- Álvaro Herrera 39°49'30"S 73°17'W — https://www.EnterpriseDB.com/

Re: Rename of triggers for partitioned tables

2021-07-22 Thread Alvaro Herrera
I pushed this patch with some minor corrections (mostly improved the message wording.) Thanks -- Álvaro Herrera Valdivia, Chile — https://www.EnterpriseDB.com/ "En las profundidades de nuestro inconsciente hay una obsesiva necesidad de un universo lógico y coherente. Pero el unive

Re: Rename of triggers for partitioned tables

2021-07-22 Thread Alvaro Herrera
On 2021-Jul-22, Arne Roland wrote: > alter table middle disable trigger b; > creates the same kind of inconsistency > alter trigger b on middle rename to something; > does. > With other words: enableing/disabling non-topmost triggers should be > forbidden as well. I'm not so sure about that ...

Re: Rename of triggers for partitioned tables

2021-07-22 Thread Arne Roland
From: Alvaro Herrera Sent: Thursday, July 22, 2021 19:33 To: Arne Roland Subject: Re: Rename of triggers for partitioned tables On 2021-Jul-22, Arne Roland wrote: > Since it is sort of the same problem, I think it might be worthwhile > to address it as well within this patch. Adding two t

Re: Rename of triggers for partitioned tables

2021-07-22 Thread Alvaro Herrera
On 2021-Jul-22, Arne Roland wrote: > I just noticed that apparently the > ALTER TABLE [ IF EXISTS ] [ ONLY ] name [ ENABLE | DISABLE ] TRIGGER ... > syntax albeit looking totally different and it already recurses, it > has precisely the same issue with pg_dump. In that case the ONLY > syntax isn't

Re: Rename of triggers for partitioned tables

2021-07-22 Thread Alvaro Herrera
On 2021-Jul-22, Arne Roland wrote: > Since it is sort of the same problem, I think it might be worthwhile > to address it as well within this patch. Adding two to four ereports > doesn't sound like scope creeping to me, even though it touches > completely different code. I'll look into that as wel

Re: Rename of triggers for partitioned tables

2021-07-22 Thread Arne Roland
From: Alvaro Herrera Sent: Thursday, July 22, 2021 18:20 To: Arne Roland Subject: Re: Rename of triggers for partitioned tables If we have good use for such an index, I don't see why we can't add it. But I'm not sure that it is justified -- certainly if the only benefit is to mak

Re: Rename of triggers for partitioned tables

2021-07-22 Thread Alvaro Herrera
On 2021-Jul-22, Arne Roland wrote: > > Hi, > > looking at the patch, I realized the renametrig_partition could use an index > leading with tgparentid, without the need to traverse the child tables. Since > we still need to lock them, there is likely no practical performance gain. > But I am

Re: Rename of triggers for partitioned tables

2021-07-22 Thread Arne Roland
, tgrelid), which sounds like a decent sanity check to have anyways. From: Alvaro Herrera Sent: Thursday, July 22, 2021 00:16 To: Arne Roland Cc: vignesh C; Zhihong Yu; Pg Hackers Subject: Re: Rename of triggers for partitioned tables ... now, thinking about how

Re: Rename of triggers for partitioned tables

2021-07-21 Thread Alvaro Herrera
... now, thinking about how does pg_dump deal with this, I think this thread is all wrong, or at least mostly wrong. We cannot have triggers in partitions with different names from the triggers in the parents. pg_dump would only dump the trigger in the parent and totally ignore the ones in childre

Re: Rename of triggers for partitioned tables

2021-07-20 Thread Alvaro Herrera
On 2021-Jul-19, Alvaro Herrera wrote: > Well, it does rename a trigger named 'name' on the table 'table_name', > as well as all its descendant triggers. I guess I am surprised that > anybody would rename a descendant trigger in the first place. I'm not > wedded to the decision of removing the NO

Re: Rename of triggers for partitioned tables

2021-07-20 Thread Alvaro Herrera
On 2021-Jul-20, Arne Roland wrote: > Thank you! I get a compile time error > trigger.c:1588:17: note: in expansion of macro ‘PG_USED_FOR_ASSERTS_ONLY’ > int found = 0 PG_USED_FOR_ASSERTS_ONLY; > ^~~~ Oh, I misplaced the annotation of course. It has to be

Re: Rename of triggers for partitioned tables

2021-07-20 Thread Arne Roland
Thank you! I get a compile time error gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -O2

Re: Rename of triggers for partitioned tables

2021-07-19 Thread Alvaro Herrera
On 2021-Jul-20, Arne Roland wrote: > Is your patch based on master? It doesn't apply at my end. It does ... master being dd498998a3 here, $ patch -p1 < /tmp/renametrig-8.patch patching file src/backend/commands/trigger.c patching file src/backend/parser/gram.y patching file src/test/regress/exp

Re: Rename of triggers for partitioned tables

2021-07-19 Thread Arne Roland
> We are referring the trigger via it's name after all. If a child is named > differently we break with that assumption. I think informing the user about > that, is very valuable. To elaborate on that: While we to similar things for things like set schema, here it has a functional relevance.

Re: Rename of triggers for partitioned tables

2021-07-19 Thread Arne Roland
Hi! From: Alvaro Herrera Sent: Tuesday, July 20, 2021 02:03 To: Arne Roland Cc: vignesh C; Zhihong Yu; Pg Hackers Subject: Re: Rename of triggers for partitioned tables I found this coding too convoluted, so I rewrote it in a different way. You tests pass with this, but I admit I haven&#

Re: Rename of triggers for partitioned tables

2021-07-19 Thread Alvaro Herrera
I found this coding too convoluted, so I rewrote it in a different way. You tests pass with this, but I admit I haven't double-checked them yet; I'll do that next. I don't think we need to give a NOTICE when the trigger name does not match; it doesn't really matter that the trigger was named diffe

Re: Rename of triggers for partitioned tables

2021-07-15 Thread Arne Roland
Hello Vignesh, thank you for your interest! From: vignesh C Sent: Thursday, July 15, 2021 14:08 To: Arne Roland Cc: Zhihong Yu; Alvaro Herrera; Pg Hackers Subject: Re: Rename of triggers for partitioned tables > The patch does not apply on Head anymore, could you rebase and post a > patc

Re: Rename of triggers for partitioned tables

2021-07-15 Thread vignesh C
On Mon, Jun 28, 2021 at 3:46 PM Arne Roland wrote: > > Hi! > > > From: Zhihong Yu > Sent: Saturday, June 26, 2021 20:32 > Subject: Re: Rename of triggers for partitioned tables > > > Hi, Arne: > > It seems the patch no longer applies cleanly on master branch

Re: Rename of triggers for partitioned tables

2021-06-28 Thread Zhihong Yu
On Mon, Jun 28, 2021 at 11:45 AM Arne Roland wrote: > Hi, > > *From:* Zhihong Yu > *Sent:* Monday, June 28, 2021 15:28 > *Subject:* Re: Rename of triggers for partitioned tables > > > -void *arg) > > +callbackForRenameTr

Re: Rename of triggers for partitioned tables

2021-06-28 Thread Arne Roland
Hi! From: Zhihong Yu Sent: Saturday, June 26, 2021 20:32 Subject: Re: Rename of triggers for partitioned tables > Hi, Arne: > It seems the patch no longer applies cleanly on master branch. > Do you mind updating the patch ? > > Thanks Thank you for having a look! Please let

Re: Rename of triggers for partitioned tables

2021-06-26 Thread Zhihong Yu
On Sat, Jun 26, 2021 at 10:08 AM Arne Roland wrote: > *From:* Alvaro Herrera > *Sent:* Saturday, June 26, 2021 18:36 > *Subject:* Re: Rename of triggers for partitioned tables > > > I'll have a look during the commitfest which starts late next week. > > Thank yo

Re: Rename of triggers for partitioned tables

2021-06-26 Thread Arne Roland
From: Alvaro Herrera Sent: Saturday, June 26, 2021 18:36 Subject: Re: Rename of triggers for partitioned tables > I'll have a look during the commitfest which starts late next week. Thank you! > (However, I'm fairly sure that it won't be in released versions ... > it

Re: Rename of triggers for partitioned tables

2021-06-26 Thread Alvaro Herrera
On 2021-Jun-26, Arne Roland wrote: > Hello Álvaro Herrera, > > I am sorry to bother, but I am still annoyed by this. So I wonder if you had > a look. I'll have a look during the commitfest which starts late next week. (However, I'm fairly sure that it won't be in released versions ... it'll on

Re: Rename of triggers for partitioned tables

2021-06-26 Thread Arne Roland
t: Re: Rename of triggers for partitioned tables Alvaro Herrera wrote: > I think the child cannot not have a corresponding trigger. If you try > to drop the trigger on child, it should say that it cannot be dropped > because the trigger on parent requires it. So I don't think there

Re: Rename of triggers for partitioned tables

2021-04-02 Thread Arne Roland
didn't bother to much. They only consist of basic sql tests. Further feedback appreciated! Thank you! Regards Arne From: Arne Roland Sent: Thursday, April 1, 2021 4:38:59 PM To: Alvaro Herrera Cc: David Steele; Pg Hackers Subject: Re: Rename of trigger

Re: Rename of triggers for partitioned tables

2021-04-01 Thread Arne Roland
Alvaro Herrera wrote: > I think the child cannot not have a corresponding trigger. If you try > to drop the trigger on child, it should say that it cannot be dropped > because the trigger on parent requires it. So I don't think there's any > case where altering name of trigger in parent would rai

Re: Rename of triggers for partitioned tables

2021-03-29 Thread Alvaro Herrera
On 2021-Mar-29, Arne Roland wrote: > Alvaro Herrera wrote: > > I think this is not what we want to do. What you're doing here as I > > understand is traversing the inheritance hierarchy down using the > > trigger name, and then fail if the trigger with that name has a > > different parent or if n

Re: Rename of triggers for partitioned tables

2021-03-29 Thread Arne Roland
Thank you for the quick reply! Alvaro Herrera wrote: > I think this is not what we want to do. What you're doing here as I > understand is traversing the inheritance hierarchy down using the > trigger name, and then fail if the trigger with that name has a > different parent or if no trigger with

Re: Rename of triggers for partitioned tables

2021-03-29 Thread Alvaro Herrera
On 2021-Mar-29, Arne Roland wrote: > @@ -1475,7 +1467,12 @@ renametrig(RenameStmt *stmt) > tuple = heap_copytuple(tuple); /* need a modifiable copy */ > trigform = (Form_pg_trigger) GETSTRUCT(tuple); > tgoid = trigform->oid; > - > + if (tgpare

Re: Rename of triggers for partitioned tables

2021-03-29 Thread Arne Roland
Attached a rebased patch with the suggested "ONLY ON" change. Regards Arne From: Arne Roland Sent: Monday, March 29, 2021 9:37:53 AM To: David Steele; Alvaro Herrera Cc: Pg Hackers Subject: Re: Rename of triggers for partitioned tables David St

Re: Rename of triggers for partitioned tables

2021-03-29 Thread Arne Roland
David Steele wrote: > Arne, thoughts on Álvaro's comments? > > Marking this patch as Waiting for Author. Thank you for the reminder. I was to absorbed by other tasks. I should be more present in the upcoming weeks. > I think you did not register the patch in commitfest, so I did that for > you:

Re: Rename of triggers for partitioned tables

2021-03-18 Thread David Steele
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

Re: Rename of triggers for partitioned tables

2021-01-15 Thread Alvaro Herrera
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

Re: Rename of triggers for partitioned tables

2020-12-28 Thread Masahiko Sawada
Hi Arne, On Fri, Nov 27, 2020 at 9:20 AM Arne Roland wrote: > > I'm sorry for the spam. Here a patch with updated comments, I missed one > before. > You sent in your patch, recursive_tgrename.2.patch to pgsql-hackers on Nov 27, but you did not post it to the next CommitFest[1]. If this was int

Re: Rename of triggers for partitioned tables

2020-11-26 Thread Arne Roland
I'm sorry for the spam. Here a patch with updated comments, I missed one before. Regards Arne From: Arne Roland Sent: Friday, November 27, 2020 1:05:02 AM To: Pg Hackers Subject: Re: Rename of triggers for partitioned tables I'm too unhapp

Re: Rename of triggers for partitioned tables

2020-11-26 Thread Arne Roland
I'm too unhappy with the interface change, so please view attached patch instead. Regards Arne From: Arne Roland Sent: Friday, November 27, 2020 12:28:31 AM To: Pg Hackers Subject: Rename of triggers for partitioned tables Hello, I got too annoyed at build