Expand description
The constraints a foreign key derives on the partitions of the partitioned table it references, named and identified as PostgreSQL’s addFkRecurseReferenced and CloneFkReferenced create them and removed as DetachPartitionFinalize and AttachPartitionForeignKey remove them.
Structs§
- Firing
Constraint - The constraint whose triggers a change to a referenced row fires, and the relation that holds it.
- Referenced
Partition - A referenced partition and the partitioned partition it belongs to, or
Nonewhen it belongs to the foreign key’s referenced table. - Referencing
Constraint - The state of the foreign key that its derived constraints follow.
Traits§
- Referenced
Partition Source - What derivation reads from the catalog.
Functions§
- firing_
constraint - The constraint of
foreign_keywhose triggers a change to a referenced row ofrelation, the partition that holds it, fires: the constraint it derives onrelation, or the foreign key’s own when the foreign key referencesrelation. A row that moves to another partition fires the constraint atmoved_through, the relation theUPDATEnames, when the foreign key references it or a table it is a partition of, asPostgreSQLfires the update triggers of the update’s root for a moved row. - reconcile_
referenced_ partition_ constraints - Make
constraintshold one derived constraint for each ofpartitions, the referenced table’s partition tree in order, keeping the constraints of partitions that remain under the same parent. The partitions that joined below one constraint since the constraints were last derived take their names from that constraint and its validity, asPostgreSQLrecurses into a new partition subtree with the name of the constraint it joins: the foreign key’s own for a partition of the referenced table, else the derived constraint of the partition’s parent. A valid foreign key validates every derived constraint, and one that is not enforced validates none. Reports whether the constraints changed. - reconcile_
table_ referenced_ partition_ constraints - Reconcile the derived constraints of every foreign key a table declares with the current partition trees of the tables they reference. A copy of a foreign key that the table’s partitioned parent declares derives none, as only the constraint without a parent derives constraints in
PostgreSQL; a copy that became the table’s own when the table was detached derives them under its own name. Reports whether any foreign key changed.