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 pgc.conname as constraint_name, | |
ccu.table_schema as table_schema, | |
ccu.table_name, | |
ccu.column_name, | |
pgc.consrc as definition | |
from pg_constraint pgc | |
join pg_namespace nsp on nsp.oid = pgc.connamespace | |
join pg_class cls on pgc.conrelid = cls.oid | |
left join information_schema.constraint_column_usage ccu | |
on pgc.conname = ccu.constraint_name |