X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 58FC7475AE5 for ; Wed, 7 May 2003 03:34:59 -0400 (EDT) Received: from sv003.int.jongert.nl (jongert.nl [194.109.59.87]) by postgresql.org (Postfix) with ESMTP id 0EA2A476514 for ; Wed, 7 May 2003 03:34:53 -0400 (EDT) Received: from IT001 (IT001.int.jongert.nl [10.0.0.241]) by sv003.int.jongert.nl (Postfix) with SMTP id B8C7C15A; Wed, 7 May 2003 09:34:48 +0200 (CEST) From: "Ries van Twisk" To: "'Tom Lane'" Cc: Subject: Re: UNIQUE boolean: only one row may be "true" Date: Wed, 7 May 2003 09:34:46 +0200 Message-ID: <002001c3146b$22a17a50$f100000a@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.1106 In-Reply-To: <24135.1052276451@sss.pgh.pa.us> Importance: Normal X-Spam-Status: No, hits=-12.2 required=5.0 tests=BAYES_10,IN_REP_TO,QUOTED_EMAIL_TEXT autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200305/112 X-Sequence-Number: 13277 Tom, > FWIW, I'd go with the unique partial index too. It's a very efficient > solution. But it's not portable :-(. I'd be interested to hear what > people would do to solve this problem in bog-standard SQL. I do it by creating a trigger (on a INSERT or UPDDATE trigger) which call's a pgsql function. Not very eficcient but I don't have that many inserts for the tables on a regular base (100 a day at the max...) Ries > -----Oorspronkelijk bericht----- > Van: pgsql-sql-owner@postgresql.org > [mailto:pgsql-sql-owner@postgresql.org]Namens Tom Lane > Verzonden: woensdag 7 mei 2003 5:01 > Aan: Randall Lucas > CC: Michael Teter; pgsql-sql@postgresql.org > Onderwerp: Re: [SQL] UNIQUE boolean: only one row may be "true" > > > Randall Lucas writes: > > Do you have any suggestions on how this might > > better be implemented? It seems to me that with a partial > index, there > > is not too much overhead and it doesn't seem too offensively > > un-boycecoddean. > > FWIW, I'd go with the unique partial index too. It's a very efficient > solution. But it's not portable :-(. I'd be interested to hear what > people would do to solve this problem in bog-standard SQL. > > regards, tom lane > > > ---------------------------(end of > broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to > majordomo@postgresql.org) >