About this question
How to list all constraints (Primary key, check, unique mutual exclusive, ..) of a table in PostgreSQL?
How to list all constraints (Primary key, check, unique mutual exclusive, ..) of a table in PostgreSQL?
Log in to share your answer and help other learners.
Log in to answerBest Answer · By JanBask MS SQL Server Expert
Answered on Oct 4, 2022
Postgres check Constraints can be retrieved via pg_catalog.pg_constraint.
SELECT con.*
FROM pg_catalog.pg_constraint con
INNER JOIN pg_catalog.pg_class rel
ON rel.oid = con.conrelid
INNER JOIN pg_catalog.pg_namespace nsp
ON nsp.oid = connamespace
WHERE nsp.nspname = ''
AND rel.relname = '';Replace with the name of your schema and