Skip to content

Commit

Permalink
Create foreign key triggers in partitioned tables too
Browse files Browse the repository at this point in the history
While user-defined triggers defined on a partitioned table have
a catalog definition for both it and its partitions, internal
triggers used by foreign keys defined on partitioned tables only
have a catalog definition for its partitions.  This commit fixes
that so that partitioned tables get the foreign key triggers too,
just like user-defined triggers.  Moreover, like user-defined
triggers, partitions' internal triggers will now also have their
tgparentid set appropriately.  This is to allow subsequent commit(s)
to make the foreign key related events to be fired in some cases
using the parent table triggers instead of those of partitions'.

This also changes what tgisinternal means in some cases.  Currently,
it means either that the trigger is an internal implementation object
of a foreign key constraint, or a "child" trigger on a partition
cloned from the trigger on the parent.  This commit changes it to
only mean the former to avoid confusion.  As for the latter, it can
be told by tgparentid being nonzero, which is now true both for user-
defined and foreign key's internal triggers.
  • Loading branch information
amitlan authored and alvherre committed Jan 5, 2022
1 parent 6ce1608 commit b1489aa
Show file tree
Hide file tree
Showing 7 changed files with 473 additions and 86 deletions.

0 comments on commit b1489aa

Please sign in to comment.