1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-17 17:02:08 +03:00

Don't clone internal triggers to partitions

Trigger cloning to partitions was supposed to occur for user-visible
triggers only, but during development the protection that prevented it
from occurring to internal triggers was lost.  Reinstate it, as well as
add a test case to ensure internal triggers (in the tested case,
triggers implementing a deferred unique constraint) are not cloned.
Without the code fix, the partitions in the test end up with different
numbers of triggers, which is clearly wrong ...

Bug in 86f575948c.

Discussion: https://postgr.es/m/20180403214903.ozfagwjcpk337uw7@alvherre.pgsql
This commit is contained in:
Alvaro Herrera
2018-04-03 19:01:34 -03:00
parent 2b3031559a
commit 851f4b4e14
3 changed files with 42 additions and 0 deletions

View File

@ -14336,6 +14336,10 @@ CloneRowTriggersToPartition(Relation parent, Relation partition)
if (!TRIGGER_FOR_ROW(trigForm->tgtype))
continue;
/* We don't clone internal triggers, either */
if (trigForm->tgisinternal)
continue;
/*
* Complain if we find an unexpected trigger type.
*/