Re: DETACH PARTITION and FOR EACH ROW triggers on partitioned tables

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Amit Langote <amitlangote09(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: DETACH PARTITION and FOR EACH ROW triggers on partitioned tables
Date: 2020-04-22 01:06:48
Message-ID: 20200422010648.GM3890@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Apr 21, 2020 at 07:03:30PM -0400, Alvaro Herrera wrote:
> On 2020-Apr-20, Justin Pryzby wrote:
>
> > On Mon, Apr 20, 2020 at 06:35:44PM +0900, Amit Langote wrote:
>
> > > Also, how about, for consistency, making the parent table labeling of
> > > the trigger look similar to that for the foreign constraint, so
> > > Triggers:
> > > TABLE "f1" TRIGGER "trig" BEFORE INSERT ON f11 FOR EACH ROW EXECUTE FUNCTION trigfunc()
> >
> > I'll leave that for committer to decide.
>
> Pushed. Many thanks for this!

Thanks for polishing it.

I was just about to convince myself of the merits of doing it Amit's way :)

I noticed a few issues:

- should put \n's around Amit's subquery to make psql -E look pretty;
- maybe should quote the TABLE, like \"%s\" ?

#3 is that *if* we did it Amit's way, I *think* maybe we should show the
parent's triggerdef, not the childs.
It seems strange to me to say "TABLE trigpart .* INSERT ON trigpart3"

- TABLE "trigpart" TRIGGER trg1 AFTER INSERT ON trigpart3 FOR EACH ROW EXECUTE FUNCTION trigger_nothing()
+ TABLE "trigpart" TRIGGER trg1 AFTER INSERT ON trigpart FOR EACH ROW EXECUTE FUNCTION trigger_nothing()

--
Justin

Attachment Content-Type Size
v6-0001-fixups-c33869cc3bfc42bce822251f2fa1a2a346f86cc5.patch text/x-diff 3.2 KB
v6-0002-show-inherited-triggers-Amit-s-way.patch text/x-diff 3.9 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2020-04-22 01:12:46 Re: Remove page-read callback from XLogReaderState.
Previous Message Kyotaro Horiguchi 2020-04-22 00:13:47 Re: forgotten initalization of a variable