From: | "David E(dot) Wheeler" <david(at)justatheory(dot)com> |
---|---|
To: | Brent Dombrowski <brent(dot)dombrowski(at)gmail(dot)com> |
Cc: | Postgresql PDX_Users <pdxpug(at)postgresql(dot)org> |
Subject: | Re: Finding the Table for Check Constraint |
Date: | 2012-05-08 17:21:43 |
Message-ID: | 5C82C7FB-8491-411F-AA07-CE38B7D5F462@justatheory.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pdxpug |
On May 8, 2012, at 10:08 AM, Brent Dombrowski wrote:
> I need to update some check constraints for a postgis migration. I can find the constraints I'm interested in the the pg_constraint catalog. However, I'm having a hell of a time trying to get the table name associated with the constraint. I can get the schema name and the column is included in the source, but the table is eluding me. Anyone have a clue they could send my way?
Join pg_constraint.conrelid to pg_class:
SELECT n.nspname, c.relname
FROM pg_catalog.pg_namespace n
JOIN pg_catalog.pg_class c ON c.relnamespace = n.oid
JOIN pg_catalog.pg_constraint x ON c.oid = x.conrelid;
HTH,
David
From | Date | Subject | |
---|---|---|---|
Next Message | Tim Bruce | 2012-05-08 17:22:48 | Re: Finding the Table for Check Constraint |
Previous Message | Brent Dombrowski | 2012-05-08 17:08:20 | Finding the Table for Check Constraint |