Skip to main content

Module relations

Module relations 

Source

Functionsยง

list_foreign_keys
Reads foreign keys for every table in db_schema, grouped by the owning (FK/child) table name. Composite foreign keys are paired column-by-column using key_column_usage.position_in_unique_constraint, which correctly lines up each FK column with its referenced column regardless of declaration order (the Java original grouped by KEY_SEQ per side independently, which risked mis-pairing columns for composite keys). Rows belonging to the same FK constraint (composite or not) are then grouped by constraint_name into a single Relation, rather than emitting one Relation per row.