Preserve firing-on state when cloning row triggers to partitions
authorAlvaro Herrera
Fri, 16 Jul 2021 17:01:43 +0000 (13:01 -0400)
committerAlvaro Herrera
Fri, 16 Jul 2021 17:01:43 +0000 (13:01 -0400)
commitc31516ae5b43d8a1a99e8e43abc84d791ce15ef1
tree5610c9b09c3d621a52d2cc323324443207885f7f
parent866237a6fa01a128325df41ad39b41ea3363c9a9
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 
Reported-by: Justin Pryzby
Discussion: https://postgr.es/m/20200930223450[email protected]
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