Created
May 26, 2015 22:11
-
-
Save pramsey/9f66327becaa729aabb3 to your computer and use it in GitHub Desktop.
Tables and Foreign Keys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select c1.relname as tbl, r.conname as constraint, c2.relname as frn_tbl | |
from pg_class c1 | |
join pg_constraint r on c1.oid = r.conrelid | |
join pg_class c2 on c2.oid = r.confrelid | |
order by frn_tbl; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment