postgresql/src/include/commands
Alvaro Herrera 6e7b37264e
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:02 +02:00
..
alter.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
async.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
cluster.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
collationcmds.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
comment.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
conversioncmds.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
copy.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
createas.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
dbcommands.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
dbcommands_xlog.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
defrem.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
discard.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
event_trigger.h Fix many typos and inconsistencies 2019-07-01 10:00:23 +09:00
explain.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
extension.h Fix many typos and inconsistencies 2019-07-01 10:00:23 +09:00
lockcmds.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
matview.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
policy.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
portalcmds.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
prepare.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
proclang.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
progress.h Add command column to pg_stat_progress_create_index 2019-06-04 09:29:02 +02:00
publicationcmds.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
schemacmds.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
seclabel.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
sequence.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
subscriptioncmds.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
tablecmds.h Fix toast rewrites in logical decoding. 2021-08-25 09:32:56 +05:30
tablespace.h Allow "in place" tablespaces. 2022-07-27 07:55:12 +02:00
trigger.h Fix ENABLE/DISABLE TRIGGER to handle recursion correctly 2022-08-05 09:47:02 +02:00
typecmds.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
user.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
vacuum.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
variable.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
view.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00