postgresql/src/include/commands
Alvaro Herrera ab85566301
Fix ENABLE/DISABLE TRIGGER to handle recursion correctly
Using ATSimpleRecursion() in ATPrepCmd() to do so as bbb927b4db did is
not correct, because ATPrepCmd() can't distinguish between triggers that
may be cloned and those that may not, so would wrongly try to recurse
for the latter category of triggers.

So this commit restores the code in EnableDisableTrigger() that
86f575948c had added to do the recursion, which would do it only for
triggers that may be cloned, that is, row-level triggers.  This also
changes tablecmds.c such that ATExecCmd() is able to pass the value of
ONLY flag down to EnableDisableTrigger() using its new 'recurse'
parameter.

This also fixes what seems like an oversight of 86f575948c that the
recursion to partition triggers would only occur if EnableDisableTrigger()
had actually changed the trigger.  It is more apt to recurse to inspect
partition triggers even if the parent's trigger didn't need to be
changed: only then can we be certain that all descendants share the same
state afterwards.

Backpatch all the way back to 11, like bbb927b4db.  Care is taken not
to break ABI compatibility (and that no catversion bump is needed.)

Co-authored-by: Amit Langote <amitlangote09@gmail.com>
Reviewed-by: Dmitry Koval <d.koval@postgrespro.ru>
Discussion: https://postgr.es/m/CA+HiwqG-cZT3XzGAnEgZQLoQbyfJApVwOTQaCaas1mhpf+4V5A@mail.gmail.com
2022-08-05 09:47:06 +02:00
..
alter.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
async.h Send NOTIFY signals during CommitTransaction. 2021-09-14 17:18:25 -04:00
cluster.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
collationcmds.h Remove utils/acl.h from catalog/objectaddress.h 2020-03-10 10:27:00 +01:00
comment.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
conversioncmds.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
copy.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
createas.h Remove utils/acl.h from catalog/objectaddress.h 2020-03-10 10:27:00 +01:00
dbcommands.h Remove utils/acl.h from catalog/objectaddress.h 2020-03-10 10:27:00 +01:00
dbcommands_xlog.h Initial pgindent and pgperltidy run for v13. 2020-05-14 13:06:50 -04:00
defrem.h Split out CreateCast into src/backend/catalog/pg_cast.c 2020-03-10 11:28:23 -03:00
discard.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
event_trigger.h Represent command completion tags as structs 2020-03-02 18:19:51 -03:00
explain.h Add the option to report WAL usage in EXPLAIN and auto_explain. 2020-04-06 08:02:15 +05:30
extension.h Remove utils/acl.h from catalog/objectaddress.h 2020-03-10 10:27:00 +01:00
lockcmds.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
matview.h Represent command completion tags as structs 2020-03-02 18:19:51 -03:00
policy.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
portalcmds.h Represent command completion tags as structs 2020-03-02 18:19:51 -03:00
prepare.h Represent command completion tags as structs 2020-03-02 18:19:51 -03:00
proclang.h Invent "trusted" extensions, and remove the pg_pltemplate catalog. 2020-01-29 18:42:43 -05:00
progress.h Report progress of streaming base backup. 2020-03-03 12:03:43 +09:00
publicationcmds.h Invalidate all partitions for a partitioned table in publication. 2021-09-22 08:24:20 +05:30
schemacmds.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
seclabel.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
sequence.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
subscriptioncmds.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
tablecmds.h Fix toast rewrites in logical decoding. 2021-08-25 09:23:27 +05:30
tablespace.h Allow "in place" tablespaces. 2022-07-27 07:55:13 +02:00
trigger.h Fix ENABLE/DISABLE TRIGGER to handle recursion correctly 2022-08-05 09:47:06 +02:00
typecmds.h Fix up recent breakage of headerscheck and cpluspluscheck. 2020-03-21 18:28:44 -04:00
user.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
vacuum.h Comments and doc fixes for commit 40d964ec99. 2020-04-14 08:10:27 +05:30
variable.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
view.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00