Expand description
Prepare referential actions and partition rewrites before publishing row changes.
Modules§
- checks
- The foreign key checks and referential actions that
PostgreSQLqueues as internal AFTER ROW triggers of a written row and runs once the statement has written its rows:RI_FKey_check_insandRI_FKey_check_updon a referencing row, theNO ACTIONandRESTRICTchecks of a referenced key that a delete or an update removed, and theCASCADE,SET NULLandSET DEFAULTactions that write the rows referencing such a key. A check therefore sees every row of the statement: a row may reference a row that the same statement writes later, and a later row’s unique or NOT NULL violation is reported first.
Structs§
- Referencing
Child Lock - Lock one referencing child row for a referential action and refetch it after the wait. Returns
Nonewhen the child vanished or its foreign-key columns no longer reference the parent key that triggered the action, so the action skips it exactly likePostgreSQLafter anEvalPlanQualrecheck of the referencing row. - Referential
Context
Enums§
Traits§
- Referential
Deferrals - The deferral of the checks a change to a referenced row fires, under the constraint
derivednames when the foreign key derives one on the firing partition. - Referential
Read Snapshot - Retained latest row images used only for referential checks under a fixed transaction snapshot.
- Referential
Snapshots
Functions§
- apply_
set_ action_ to_ child - defer_
deleted_ key_ checks - Leave for the transaction the checks of the referenced keys that a delete of the row
parent_documentofparent_tableremoves, under a deferredNO ACTIONforeign key: the key’s event, and each row that references the key, which the transaction checks again when the constraint becomes immediate. A row inroot_deletes, which the same statement deletes, needs no check. - defer_
updated_ key_ checks - Leave for the transaction the checks of the referenced keys that an update of the row
old_docoftabletonew_docremoves, under a deferredNO ACTIONforeign key: the key’s event, and each row that references the key, which the transaction checks again when the constraint becomes immediate.referenced_relationis the relation whose constraints the change fires: the row’s table, or the relation anUPDATEnames when the row moves to another partition. - lock_
referencing_ child - prepare_
document_ delete - Lock the row that
tableholds atdoc_idand prepare its delete, firing its BEFORE ROW triggers whenfire_row_triggersholds, and leave for the transaction the checks of the deferredNO ACTIONkeys it removes.root_deletesholds the rows the same statement deletes.Nonewhen the row is gone or a BEFORE ROW trigger skipped it. - prepare_
document_ rewrite - Lock one row for its rewrite while the backend transaction is still deferred, and leave for the transaction the checks of the deferred
NO ACTIONkeys the rewrite removes.referenced_relationis the relation whose constraints a change to the row’s referenced key fires: the row’s table, or the relation anUPDATEnames when the row moves to another partition. - prepare_
partition_ update_ route - prepare_
referential_ document_ rewrite - Prepare the rewrite that a referential action makes of a referencing row: its BEFORE ROW triggers fire, and a partitioned table routes the new row.
- prepare_
routed_ document_ rewrite - referencing_
rows - refresh_
updated_ generated_ columns - Finish the UPDATE row after its BEFORE triggers, using
PostgreSQL’s relation trigger descriptor and statement target columns. - reject_
partition_ rewrite - An
ON CONFLICT DO UPDATEmay not move the row it updates to another partition, which it would when the new row fails the partition constraint of the row’s partition (ExecCrossPartitionUpdate).