X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0BBE29DC803 for ; Mon, 6 Feb 2006 14:05:55 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 09105-06 for ; Mon, 6 Feb 2006 14:05:54 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id B6E6E9DC862 for ; Mon, 6 Feb 2006 14:05:52 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id k16I5nGe027879; Mon, 6 Feb 2006 13:05:49 -0500 (EST) To: lrotger cc: pgsql-admin@postgresql.org Subject: Re: Actual expression of a constraint In-reply-to: <43E71F51.7030108@aircomp.aero> References: <43E71F51.7030108@aircomp.aero> Comments: In-reply-to lrotger message dated "Mon, 06 Feb 2006 11:05:05 +0100" Date: Mon, 06 Feb 2006 13:05:49 -0500 Message-ID: <27878.1139249149@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.107 required=5 tests=[AWL=0.107] X-Spam-Score: 0.107 X-Spam-Level: X-Archive-Number: 200602/61 X-Sequence-Number: 20482 lrotger writes: > I know I could dig this out of the manuals so don't be too hard on me, > I'd like to know how to query the actual text of the expression of a > constraint. I know the name of the constraint and of the table. Something like this: regression=# create table t1 (f1 int constraint c1 check (f1 > 0)); CREATE TABLE regression=# select pg_get_constraintdef(c.oid) regression-# from pg_constraint c join pg_class t on c.conrelid = t.oid regression-# where t.relname = 't1' and c.conname = 'c1'; pg_get_constraintdef ---------------------- CHECK ((f1 > 0)) (1 row) You can probably also get it from the information_schema. regards, tom lane