Hi again,
After trying to use pg_get_catalog_foreign_keys() to replace what I had before,
I notice one ambiguity which I think is a serious problem in the
machine-readable context.
The is_array OUT parameter doesn't say which of the possibly many fkcols that
is the array column.
One example:
fktable | fkcols | pktable | pkcols
| is_array
----------------------+-----------------------+--------------+-------------------+----------
pg_constraint | {conrelid,conkey} | pg_attribute | {attrelid,attnum}
| t
Is the array "conrelid" or is it "conkey"? As a human, I know it's "conkey",
but for a machine to figure out, one would need to join
information_schema.columns and check the data_type or something similar.
Suggestions on how to fix:
* Make is_array an boolean[], and let each element represent the is_array value
for each fkcols element.
* Change interface to be more like information_schema, and add a
"ordinal_position" column, and return each column on a separate row.
I think I prefer the latter since it's more information_schema-conformant, but
any works.
/Joel