X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 550B8D1CCDC for ; Tue, 6 Apr 2004 11:28:47 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 61958-06 for ; Tue, 6 Apr 2004 11:29:32 -0300 (ADT) Received: from bramble.mmrd.com (unknown [65.217.53.66]) by svr1.postgresql.org (Postfix) with ESMTP id 21579D1BAFC for ; Tue, 6 Apr 2004 11:28:44 -0300 (ADT) Received: from thorn.mmrd.com (thorn.mmrd.com [172.25.10.100]) by bramble.mmrd.com (8.12.8/8.12.8) with ESMTP id i36EUQcM032476 for ; Tue, 6 Apr 2004 10:30:26 -0400 Received: from gnvex001.mmrd.com (gnvex001.mmrd.com [192.168.3.55]) by thorn.mmrd.com (8.11.6/8.11.6) with ESMTP id i36ETWl07815 for ; Tue, 6 Apr 2004 10:29:32 -0400 Received: from camel.mmrd.com ([172.25.5.213]) by gnvex001.mmrd.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2657.72) id FVMA7LF9; Tue, 6 Apr 2004 10:29:31 -0400 Subject: partial unique constraint From: Robert Treat To: pgsql-sql@postgresql.org Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 06 Apr 2004 10:29:32 -0400 Message-Id: <1081261772.31785.48.camel@camel> Mime-Version: 1.0 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200404/35 X-Sequence-Number: 17410 Trying to come up with the proper syntax to meet the following criteria: create table foo (bar integer, baz boolean UNIQUE (bar, baz = true)); note the above syntax is not correct, but should demonstrate what i'm trying to do; I want to add a unique constraint such that we only allow one case of bar and baz = true... i can have unlimited bar and baz = false, and there can be multiple bar and baz = true if the bars are different... did some doc reading and mail list searching but a valid syntax for this seems to be escaping me... btw I'm pretty sure I could do this with an external trigger, but am wondering about a constraint oriented approach Robert Treat -- Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL