I need to find all the constraint in only one consult and I don't know how to do it.
I am trying to do it whit the next query:
SELECT UPPER(conname) AS restriccion, UPPER(relname) AS tabla, UPPER(pg_catalog.pg_attribute.attname) AS columna
FROM pg_catalog.pg_constraint, pg_catalog.pg_class, pg_catalog.pg_attribute
WHERE contype = 'u'
AND conrelid = pg_catalog.pg_class.oid
AND conrelid = pg_catalog.pg_attribute.attrelid
AND pg_catalog.pg_attribute.attnum = pg_catalog.pg_constraint.conkey[1]
ORDER BY UPPER(conname), UPPER(relname), UPPER(pg_catalog.pg_attribute.attname);
I am doing it changing the letter 'u' with 'c' to see the check constraints but it is a bit difficult...
Is there another way to see all the constraint in only one query? Thanks!