]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Preserve firing-on state when cloning row triggers to partitions
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Fri, 16 Jul 2021 17:01:43 +0000 (13:01 -0400)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Fri, 16 Jul 2021 17:01:43 +0000 (13:01 -0400)
commitfed35bd4a65032f714af6bc88c102d0e90422dee
treedb8b5bc09e753029e313bce77f420ff4d58983d2
parent85a8c3a4b60f430ba30d58427558f1686251b8b5
Preserve firing-on state when cloning row triggers to partitions

When triggers are cloned from partitioned tables to their partitions,
the 'tgenabled' flag (origin/replica/always/disable) was not propagated.
Make it so that the flag on the trigger on partition is initially set to
the same value as on the partitioned table.

Add a test case to verify the behavior.

Backpatch to 11, where this appeared in commit 86f575948c77.

Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
Reported-by: Justin Pryzby <pryzby@telsasoft.com>
Discussion: https://postgr.es/m/20200930223450.GA14848@telsasoft.com
src/backend/commands/tablecmds.c
src/backend/commands/trigger.c
src/include/commands/trigger.h
src/test/regress/expected/triggers.out
src/test/regress/sql/triggers.sql