Sascha Bohnenkamp <bohnenkamp (AT) mevisbreastcare (DOT) de> wrote:
Quote:
I am looking for a query to get all constraints of a table and its columns.
We sometime need such information  |
Are you looking for something like this:
SELECT t.relname AS table, conkey AS columns, conname,
contype, f.relname AS destination
FROM pg_constraint AS c JOIN pg_class AS t ON (t.oid = c.conrelid)
LEFT OUTER JOIN pg_class f ON (c.confrelid = f.oid)
WHERE t.relname='anyoldtablename';
Yours,
Laurenz Albe