I\'m using PostgreSQL and I\'m trying to list all the tables that have a particular column from a table as a foreign-key/reference. Can this be done? I\'m sure this information
If you use the psql client, you can simply issue the \d table_name
command to see which tables reference the given table. From the linked documentation page:
\d[S+] [ pattern ]
For each relation (table, view, materialized view, index, sequence, or foreign table) or composite type matching the
pattern
, show all columns, their types, the tablespace (if not the default) and any special attributes such asNOT NULL
or defaults. Associated indexes, constraints, rules, and triggers are also shown. For foreign tables, the associated foreign server is shown as well.