title: Finding constraints in PostgreSQL
body: <p>I need to find all the constraint in only one consult and I don't know how to do it.</p>
  
  <p>I am trying to do it whit the next query:</p>
  
  <pre><code>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);
  </code></pre>
  
  <p>I am doing it changing the letter 'u' with 'c' to see the check constraints but it is a bit difficult...</p>
  
  <p>Is there another way to see all the constraint in only one query? Thanks!</p>