postgresql/src/include
Alvaro Herrera ec0925c22a
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:26 +02:00
..
access Remove configure probe for fdatasync. 2022-08-05 16:37:38 +12:00
bootstrap Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
catalog Improve performance of ORDER BY / DISTINCT aggregates 2022-08-02 23:11:45 +12:00
commands Fix ENABLE/DISABLE TRIGGER to handle recursion correctly 2022-08-05 09:47:26 +02:00
common Change internal RelFileNode references to RelFileNumber or RelFileLocator. 2022-07-06 11:39:09 -04:00
datatype Fix overflow hazards in interval input and output conversions. 2022-04-02 16:12:29 -04:00
executor Remove unused fields from ExprEvalStep 2022-08-03 09:46:02 +12:00
fe_utils Add xheader_width pset option to psql 2022-07-25 14:25:02 -04:00
foreign Update copyright for 2022 2022-01-07 19:04:57 -05:00
jit Add central declarations for dlsym()ed symbols 2022-07-17 17:23:42 -07:00
lib Add missing inequality searches to rbtree 2022-07-08 22:00:03 +03:00
libpq Emulate sigprocmask(), not sigsetmask(), on Windows. 2022-07-16 17:03:38 +12:00
mb Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
nodes Fix ENABLE/DISABLE TRIGGER to handle recursion correctly 2022-08-05 09:47:26 +02:00
optimizer Fix incorrect tests for SRFs in relation_can_be_sorted_early(). 2022-08-03 17:33:42 -04:00
parser Make subquery aliases optional in the FROM clause. 2022-07-20 09:29:42 +01:00
partitioning Have ExecFindPartition cache the last found partition 2022-08-02 09:55:27 +12:00
port Remove configure probe for fdatasync. 2022-08-05 16:37:38 +12:00
portability Remove configure probe for clock_gettime. 2022-08-05 16:37:11 +12:00
postmaster Add central declarations for dlsym()ed symbols 2022-07-17 17:23:42 -07:00
regex Remove configure probe for wctype.h. 2022-07-23 16:54:00 +12:00
replication Fix formatting and comment typos 2022-08-04 16:41:29 +07:00
rewrite Update copyright for 2022 2022-01-07 19:04:57 -05:00
snowball Update copyright for 2022 2022-01-07 19:04:57 -05:00
statistics Add stxdinherit flag to pg_statistic_ext_data 2022-01-16 13:38:01 +01:00
storage Fix inconsistent comments for some function declarations in headers 2022-08-04 17:36:21 +09:00
tcop Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
tsearch Remove configure probe for wctype.h. 2022-07-23 16:54:00 +12:00
utils Move common catalog cache access routines to lsyscache.c 2022-08-02 10:47:22 +05:30
.gitignore Refactor dlopen() support 2018-09-06 11:33:04 +02:00
c.h Add wal_sync_method=fdatasync for Windows. 2022-07-20 13:55:52 +12:00
fmgr.h Mark all symbols exported from extension libraries PGDLLEXPORT. 2022-07-17 18:50:14 -07:00
funcapi.h Create routine able to set single-call SRFs for Materialize mode 2022-03-07 10:26:29 +09:00
getaddrinfo.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
getopt_long.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
Makefile Install generated nodes/nodetags.h 2022-07-09 10:20:23 +02:00
miscadmin.h Process session_preload_libraries within InitPostgres's transaction. 2022-07-25 10:27:43 -04:00
pg_config_ext.h.in
pg_config_manual.h Remove durable_rename_excl() 2022-07-05 12:54:25 +09:00
pg_config.h.in Remove configure probe for fdatasync. 2022-08-05 16:37:38 +12:00
pg_getopt.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
pg_trace.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
pgstat.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
pgtar.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
pgtime.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
port.h Remove dead pread and pwrite replacement code. 2022-08-05 09:49:21 +12:00
postgres_ext.h Change internal RelFileNode references to RelFileNumber or RelFileLocator. 2022-07-06 11:39:09 -04:00
postgres_fe.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
postgres.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
rusagestub.h Remove dead getrusage replacement code. 2022-07-24 09:29:48 +12:00
windowapi.h Update copyright for 2022 2022-01-07 19:04:57 -05:00