Re: enable/disable broken for statement triggers on partitioned tables - Mailing list pgsql-hackers

From Amit Langote
Subject Re: enable/disable broken for statement triggers on partitioned tables
Date
Msg-id CA+HiwqE-pm7np3bjVapjhKYte+QYS-XaHKAaApB-TGriTdVFuw@mail.gmail.com
Whole thread Raw
In response to Re: enable/disable broken for statement triggers on partitioned tables  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: enable/disable broken for statement triggers on partitioned tables
List pgsql-hackers
On Sat, Jul 30, 2022 at 5:25 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> > Yeah, I don't know about adding tons of values to that enum just so that
> > we can use that to hide a boolean inside.  Why not add a boolean to the
> > containing struct?  Something like the attached.
>
> I do not think it's a great idea to have ALTER TABLE scribbling on
> the source parsetree.

Hmm, I think we already do scribble on the source parse tree even
before this patch, for example, as ATPrepCmd() does for DROP
CONSTRAINT:

            if (recurse)
                cmd->subtype = AT_DropConstraintRecurse;

>  That tree could be in plancache and subject
> to reuse later.

I see that 7c337b6b527b added 'readOnlyTree' to
standard_ProcessUtility()'s API, I guess, to make any changes that
AlterTable() and underlings make to the input AlterTableStmt be local
to a given execution.  Though, maybe that's not really a permission to
add more code that makes such changes?

In this case of needing to remember the inh/recurse flag mentioned in
the original AT command, we could avoid scribbling over the input
AlterTableStmt by setting a new flag in AlteredTableInfo, instead of
AlterTableCmd.  AlteredTableInfo has other runtime info about the
relation being altered and perhaps it wouldn't be too bad if it also
stores the inh/recurse flag.

-- 
Thanks, Amit Langote
EDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: "houzj.fnst@fujitsu.com"
Date:
Subject: RE: Collect ObjectAddress for ATTACH DETACH PARTITION to use in event trigger
Next
From: Etsuro Fujita
Date:
Subject: Re: Fast COPY FROM based on batch insert