mirror of
https://github.com/postgres/postgres.git
synced 2025-08-19 23:22:23 +03:00
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 86f575948c
.
Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
Reported-by: Justin Pryzby <pryzby@telsasoft.com>
Discussion: https://postgr.es/m/20200930223450.GA14848@telsasoft.com
This commit is contained in:
@@ -15675,10 +15675,10 @@ CloneRowTriggersToPartition(Relation parent, Relation partition)
|
||||
trigStmt->initdeferred = trigForm->tginitdeferred;
|
||||
trigStmt->constrrel = NULL; /* passed separately */
|
||||
|
||||
CreateTrigger(trigStmt, NULL, RelationGetRelid(partition),
|
||||
trigForm->tgconstrrelid, InvalidOid, InvalidOid,
|
||||
trigForm->tgfoid, HeapTupleGetOid(tuple), qual,
|
||||
false, true);
|
||||
CreateTriggerFiringOn(trigStmt, NULL, RelationGetRelid(partition),
|
||||
trigForm->tgconstrrelid, InvalidOid, InvalidOid,
|
||||
trigForm->tgfoid, HeapTupleGetOid(tuple), qual,
|
||||
false, true, trigForm->tgenabled);
|
||||
|
||||
MemoryContextSwitchTo(oldcxt);
|
||||
MemoryContextReset(perTupCxt);
|
||||
|
Reference in New Issue
Block a user