Re: DETACH PARTITION and FOR EACH ROW triggers on partitioned tables
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Amit Langote <amitlangote09@gmail.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>,
Justin Pryzby <pryzby@telsasoft.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2020-04-09T13:46:38Z
Lists: pgsql-hackers
Amit Langote <amitlangote09@gmail.com> writes: > On Thu, Apr 9, 2020 at 3:09 AM Tom Lane <tgl@sss.pgh.pa.us> wrote: >> My point is that so long as you only allow the case of exactly one parent, >> you can just delete the child trigger, because it must belong to that >> parent. As soon as there's any flexibility, you are going to end up >> reinventing all the stuff we had to invent to manage >> maybe-or-maybe-not-inherited columns. So I think the "detach" idea >> is the first step on that road, and I counsel not taking that step. > As mentioned upthread, we have behavior #1 for indexes (attach > existing / detach & keep), without any of the *islocal, *inhcount > infrastructure. It is a bit complex, because we need logic to check > the equivalence of an existing index on the partition being attached, > so implementing the same behavior for trigger is going to have to be > almost as complex. Considering that #2 will be much simpler to > implement, but would be asymmetric with everything else. I think there is justification for jumping through some hoops for indexes, because they can be extremely expensive to recreate. The same argument doesn't hold even a little bit for child triggers, though. Also it can be expected that an index will still behave sensibly after its table is standalone, whereas that's far from obvious for a trigger that was meant to work on partition member tables. regards, tom lane
Commits
-
psql \d: Display table where trigger is defined, if inherited
- c33869cc3bfc 13.0 landed
-
Document partitiong tables ancillary object handling some more
- cda02408f20d 12.3 landed
- 97dcd5cd1500 11.8 landed
- 8803506c411e 13.0 landed
-
Fix detaching partitions with cloned row triggers
- e26c8a6b31e9 12.3 landed
- afccd76f1cce 13.0 landed
- 0b83c47216b0 11.8 landed