Re: CREATE TABLE .. PARTITION OF fails to preserve tgenabled for inherited row triggers
Justin Pryzby <pryzby@telsasoft.com>
From: Justin Pryzby <pryzby@telsasoft.com>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, pgsql-hackers@postgresql.org, Amit Langote <amitlangote09@gmail.com>
Date: 2020-10-21T11:54:53Z
Lists: pgsql-hackers
Attachments
On Tue, Oct 20, 2020 at 09:54:53PM -0300, Alvaro Herrera wrote: > On 2020-Oct-20, Justin Pryzby wrote: > > On Tue, Oct 20, 2020 at 03:56:30PM -0400, Tom Lane wrote: > > > Alvaro Herrera <alvherre@alvh.no-ip.org> writes: > > > > Hmm, next question: should we backpatch a fix for this? (This applies > > > > all the way back to 11.) If we do, then we would change behavior of > > > > partition creation. It's hard to see that the current behavior is > > > > desirable ... and I think anybody who would have come across this, would > > > > wish it behaved the other way. But still -- it would definitely be a > > > > behavior change. > > > > > > The behavior change seems like it'd be an improvement in a vacuum, > > > but I wonder how it would interact with catalog contents left behind > > > by the old misbehavior. Also, would we expect pg_dump to try to do > > > anything to clean up the mess? If so, allowing a back branch to have > > > had more than one behavior would complicate that greatly. > > > > I don't think there's a problem with catalog content ? > > I think it's fine if there's an enabled child trigger inheriting from a > > disabled parent? This changes the initial tgenabled for new partitions. > > I don't think we'd need to do anything special here ... particularly > considering the discovery that pg_dump does not preserve the disable > status of trigger on partitions: > > > However...it looks like pg_dump should ALTER the child trigger state if it > > differ from its parent. Or maybe it needs to CREATE child triggers with the > > proper state before attaching the child table ? > > I guess *something* needs to be done, but I'm not clear on what it is. > Creating the trigger on partition beforehand does not work: an error is > raised on attach that the trigger already exists. > > The only way I see to do this, is to have pg_dump extract tgenabled for I came up with this, which probably needs more than a little finesse. -- Justin
Commits
-
Fix pg_dump for disabled triggers on partitioned tables
- f0e21f2f6167 15.0 landed
- ccfc3cbb341a 11.13 landed
- cc340af33453 13.4 landed
- 5992c94dc7e4 12.8 landed
- 3c5b7c628621 14.0 landed
-
Preserve firing-on state when cloning row triggers to partitions
- fed35bd4a650 11.13 landed
- eef92de11e50 14.0 landed
- df80fa2ee504 15.0 landed
- c31516ae5b43 13.4 landed
- 7584ec1f6098 12.8 landed
-
Fix ALTER TABLE .. ENABLE/DISABLE TRIGGER recursion
- bbb927b4db9b 14.0 landed
- a795f6782fa8 11.10 landed
- 5f6463a20af1 13.1 landed
- 0e6b6f8c7192 12.5 landed
-
psql \d: Display table where trigger is defined, if inherited
- c33869cc3bfc 13.0 cited
-
Fix cloning of row triggers to sub-partitions
- 1fa846f1c9af 13.0 cited
-
Make pg_dump emit ATTACH PARTITION instead of PARTITION OF (reprise)
- 33a53130a894 12.0 cited