From: | Justin Pryzby <pryzby(at)telsasoft(dot)com> |
---|---|
To: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Amit Langote <amitlangote09(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: DETACH PARTITION and FOR EACH ROW triggers on partitioned tables |
Date: | 2020-04-19 20:49:12 |
Message-ID: | 20200419204911.GQ26953@telsasoft.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sun, Apr 19, 2020 at 03:13:29PM -0400, Alvaro Herrera wrote:
> On 2020-Apr-18, Justin Pryzby wrote:
> > I haven't heard a compelling argument for or against either way.
> >
> > Maybe the worst behavior might be if, during ATTACH, we searched for a matching
> > trigger, and "merged" it (marked it inherited) if it matched. That could be
> > bad if someone *wanted* two triggers, which seems unlikely, but to each their
> > own.
>
> I think the simplicity argument trumps the other ones, so I agree to go
> with your v3 patch proposed downthread.
>
> What happens if you detach the parent? I mean, should the trigger
> removal recurse to children?
It think it should probably exactly undo what CloneRowTriggersToPartition does.
..and I guess you're trying to politely say that it didn't. I tried to fix in
v4 - please check if that's right.
> > It occured to me that we don't currently distinguish between a trigger on a
> > child table, and a trigger on a parent table which was recursively created on a
> > child. That makes sense for indexes and constraints, since the objects persist
> > if the table is detached, so it doesn't matter how it was defined.
> >
> > But if we remove trigger during DETACH, then it's *not* the same as a trigger
> > that was defined on the child, and I suggest that in v13 we should make that
> > visible.
>
> Hmm, interesting point -- whether the trigger is partition or not is
> important because it affects what happens on detach. I agree that we
> should make it visible. Is the proposed single bit "PARTITION" good
> enough, or should we indicate what's the ancestor table that defines the
> partition?
Yea, it's an obvious thing to do.
One issue is that tgparentid is new, so showing the partition status of the
trigger when connected to an pre-13 server would be nontrivial: b9b408c48.
--
Justin
Attachment | Content-Type | Size |
---|---|---|
v4-0001-fix-detaching-tables-with-inherited-row-triggers.patch | text/x-diff | 8.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tomas Vondra | 2020-04-19 21:18:53 | Re: [PATCH] Small optimization across postgres (remove strlen duplicate usage) |
Previous Message | Alvaro Herrera | 2020-04-19 20:38:15 | Re: DETACH PARTITION and FOR EACH ROW triggers on partitioned tables |