X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D3D859DC8AD for ; Sun, 5 Mar 2006 13:51:14 -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 63804-03 for ; Sun, 5 Mar 2006 13:51:10 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from mail.gmx.net (mail.gmx.de [213.165.64.20]) by postgresql.org (Postfix) with SMTP id B797C9DCCBA for ; Sun, 5 Mar 2006 13:51:08 -0400 (AST) Received: (qmail invoked by alias); 05 Mar 2006 17:51:08 -0000 Received: from L7292.l.strato-dslnet.de (EHLO merkur.hilbert.loc) [89.48.114.146] by mail.gmx.net (mp033) with SMTP; 05 Mar 2006 18:51:08 +0100 X-Authenticated: #1433807 Received: from ncq by merkur.hilbert.loc with local (Exim 4.60) (envelope-from ) id 1FFqUg-0001qP-5d for pgsql-sql@postgresql.org; Sun, 05 Mar 2006 11:29:42 +0100 Date: Sun, 5 Mar 2006 11:29:42 +0100 From: Karsten Hilbert To: pgsql-sql@postgresql.org Subject: Re: Check/unique constraint question Message-ID: <20060305102942.GA7051@merkur.hilbert.loc> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.11+cvs20060126 X-Y-GMX-Trusted: 0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.814 required=5 tests=[AWL=-0.208, DATE_IN_PAST_06_12=0.746, MAILTO_TO_SPAM_ADDR=0.276] X-Spam-Score: 0.814 X-Spam-Level: X-Archive-Number: 200603/96 X-Sequence-Number: 24442 On Sun, Mar 05, 2006 at 12:02:58PM +0300, Nikolay Samokhvalov wrote: > Unfortunately, at the moment Postgres doesn't support subqueries in > CHECK constraints, so it's seems that you should use trigger to check > what you need The OP could also use a check constraint with a function if everything (the context) but the value to check is known beforehand or can be derived from it. Karsten -- GPG key ID E4071346 @ wwwkeys.pgp.net E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346