postgresql/src/include/commands
Alvaro Herrera 731d514ae5
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:11 +02:00
..
alter.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
async.h Send NOTIFY signals during CommitTransaction. 2021-09-14 17:18:25 -04:00
cluster.h Refactor option handling of CLUSTER, REINDEX and VACUUM 2021-01-18 14:03:10 +09:00
collationcmds.h Revert per-index collation version tracking feature. 2021-05-07 21:10:11 +12:00
comment.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
conversioncmds.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
copy.h Initial pgindent and pgperltidy run for v14. 2021-05-12 13:14:10 -04:00
copyfrom_internal.h Initial pgindent and pgperltidy run for v14. 2021-05-12 13:14:10 -04:00
createas.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
dbcommands.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
dbcommands_xlog.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
defrem.h Initial pgindent and pgperltidy run for v14. 2021-05-12 13:14:10 -04:00
discard.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
event_trigger.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
explain.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
extension.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
lockcmds.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
matview.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
policy.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
portalcmds.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
prepare.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
proclang.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
progress.h Split backend status and progress related functionality out of pgstat.c. 2021-04-03 11:42:52 -07:00
publicationcmds.h Invalidate all partitions for a partitioned table in publication. 2021-09-22 08:13:37 +05:30
schemacmds.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
seclabel.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
sequence.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
subscriptioncmds.h Allow multiple xacts during table sync in logical replication. 2021-02-12 07:41:51 +05:30
tablecmds.h Fix toast rewrites in logical decoding. 2021-08-25 10:10:50 +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:11 +02:00
typecmds.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
user.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
vacuum.h Don't overlook indexes during parallel VACUUM. 2021-11-02 12:06:16 -07:00
variable.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
view.h Update copyright for 2021 2021-01-02 13:06:25 -05:00