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 BF4B1D1C50B for ; Tue, 6 Apr 2004 12:05:54 -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 85061-01 for ; Tue, 6 Apr 2004 12:05:51 -0300 (ADT) Received: from jongert.nl (jongert.nl [194.109.59.87]) by svr1.postgresql.org (Postfix) with ESMTP id D994FD1D370 for ; Tue, 6 Apr 2004 12:05:50 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by jongert.nl (Postfix) with SMTP id AF99C3C81EC; Tue, 6 Apr 2004 17:05:40 +0200 (CEST) X-AV-Checked: Tue Apr 6 17:05:40 2004 jongert.nl Received: from IT001 (IT001.int.jongert.nl [10.0.1.253]) by jongert.nl (Postfix) with SMTP id 8E1E13C81D5 for ; Tue, 6 Apr 2004 17:05:40 +0200 (CEST) From: To: Subject: Re: partial unique constraint Date: Tue, 6 Apr 2004 17:05:37 +0200 Message-ID: <001601c41be8$9ece4f60$fd01000a@IT001> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook CWS, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 In-Reply-To: <1081261772.31785.48.camel@camel> Importance: Normal X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200404/39 X-Sequence-Number: 17414 You should create a functional index here. Ries > -----Oorspronkelijk bericht----- > Van: pgsql-sql-owner@postgresql.org > [mailto:pgsql-sql-owner@postgresql.org]Namens Robert Treat > Verzonden: dinsdag 6 april 2004 16:30 > Aan: pgsql-sql@postgresql.org > Onderwerp: [SQL] partial unique constraint > > > 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 > > > ---------------------------(end of > broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings >