X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id C626E9FB321 for ; Thu, 10 Aug 2006 16:28:12 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 27401-04 for ; Thu, 10 Aug 2006 19:28:05 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from my.endian.it (unknown [62.146.87.34]) by postgresql.org (Postfix) with ESMTP id BC5259FB31F for ; Thu, 10 Aug 2006 16:28:04 -0300 (ADT) Received: from dell.home.lan (host188-110.pool874.interbusiness.it [87.4.110.188]) (authenticated (0 bits)) by my.endian.it (8.11.6/8.11.6) with ESMTP id k7AJZrT31998; Thu, 10 Aug 2006 21:35:53 +0200 Subject: Re: Querying constraints? From: Chris Mair To: Lexington Luthor Cc: pgsql-sql@postgresql.org In-Reply-To: <1155237920.5893.50.camel@dell.home.lan> References: <1155237920.5893.50.camel@dell.home.lan> Content-Type: text/plain Date: Thu, 10 Aug 2006 21:27:57 +0200 Message-Id: <1155238077.5893.52.camel@dell.home.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-27) Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.135 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200608/70 X-Sequence-Number: 26028 > Curiously enough, I just answered a similar question on the pgsql-admin > list. Try this: > > SELECT c.relname as table, r.conname as contraint_name, r.contype as > contraint_type, pg_catalog.pg_get_constraintdef(r.oid, true) as > constraint_definition FROM pg_catalog.pg_constraint r, > pg_catalog.pg_class c WHERE c.oid = r.conrelid; I forgot to mention, it's tested on 8.1... Bye, Chris. -- Chris Mair http://www.1006.org