Fix cloning of row triggers to sub-partitions
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Thu, 2 Jan 2020 20:04:24 +0000 (17:04 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Thu, 2 Jan 2020 20:04:24 +0000 (17:04 -0300)
commitd732148398a6e406170383ab21960ac373cd1316
tree0550bf94c3911274dd13fa49ea974ad30061b9a3
parent98b75c38c6ed2701c278316daac744222a1d56dd
Fix cloning of row triggers to sub-partitions

When row triggers exist in partitioned partitions that are not either
part of FKs or deferred unique constraints, they are not correctly
cloned to their partitions.  That's because they are marked "internal",
and those are purposefully skipped when doing the clone triggers dance.
Fix by relaxing the condition on which internal triggers are skipped.

Amit Langote initially diagnosed the problem and proposed a fix, but I
used a different approach.

Reported-by: Petr Fedorov
Discussion: https://postgr.es/m/6b3f0646-ba8c-b3a9-c62d-1c6651a1920f@phystech.edu
src/backend/commands/tablecmds.c
src/test/regress/expected/triggers.out
src/test/regress/sql/triggers.sql