Foreign keys
There is no separate reverse-index key family for foreign keys. The reverse lookup, from a parent row to its child rows, uses one of these:
- the child’s primary key, or
- a B-tree index on the child whose leading columns are the foreign key columns. A lookup scans the matching prefix under both
0x02(non-unique) and0x03(unique).
If neither exists, an ordinary secondary index is created for it (SPEC V18). The code is relations::reverse_for (crates/strata-sql/src/relations.rs:187).
The foreign key definitions are stored in the table definition, see Ext R: relations, and the names and ON UPDATE actions in Ext S and Ext M.