postgresql/src
Alvaro Herrera e78fd90845
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:15 +02:00
..
backend Fix ENABLE/DISABLE TRIGGER to handle recursion correctly 2022-08-05 09:47:15 +02:00
bin Revert recent changes to 002_pg_upgrade.pl. 2022-08-04 15:26:24 -04:00
common Fix get_dirent_type() for symlinks on MinGW/MSYS. 2022-07-28 14:27:28 +12:00
fe_utils Fix minor memory leaks in psql's tab completion. 2022-07-22 10:53:26 -04:00
include Fix ENABLE/DISABLE TRIGGER to handle recursion correctly 2022-08-05 09:47:15 +02:00
interfaces Fix [install]check in interfaces/libpq/Makefile 2022-07-22 20:15:11 +02:00
makefiles Refactor DLSUFFIX handling 2022-03-25 08:56:02 +01:00
pl Fix missed corner cases for grantable permissions on GUCs. 2022-07-19 17:22:31 -04:00
port Fix get_dirent_type() for Windows junction points. 2022-07-22 16:57:36 +12:00
template Refactor DLSUFFIX handling 2022-03-25 08:56:02 +01:00
test Fix ENABLE/DISABLE TRIGGER to handle recursion correctly 2022-08-05 09:47:15 +02:00
timezone Update time zone data files to tzdata release 2022a. 2022-05-05 14:54:53 -04:00
tools expression eval: Fix EEOP_JSON_CONSTRUCTOR and EEOP_JSONEXPR size. 2022-07-05 11:26:27 -07:00
tutorial Update copyright for 2022 2022-01-07 19:04:57 -05:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Remove the option to build thread_test.c outside configure. 2020-10-21 12:08:48 -04:00
Makefile.global.in Increase minimum supported GNU make version to 3.81. 2022-07-23 12:12:42 -04:00
Makefile.shlib AIX: Fix missing libpq symbols by respecting SHLIB_EXPORTS. 2021-09-06 11:27:59 -07:00
nls-global.mk Improve frontend error logging style. 2022-04-08 14:55:14 -04:00