Both *pragma_foreign_key_list* and *pragma_index_list* return tables containing a row for each unique (column, index/FK) combination. The Foreign Keys query starts with a copy of the *table* block. The *columns* block, however, needs adjustments to take into account the signature and semantics of the returned table (*fkey_columns*). Furthermore, for composite indices/FKs, one row is returned for each participating column. Often, it is more convenient to have one row per index/FK, meaning that an additional WITH block is necessary to collapse rows corresponding to the same composite index/FK, as shown in [Fig. 2](#ForeignKeys).
0 commit comments