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 E7B64D1ED0B for ; Tue, 6 Apr 2004 12:17:07 -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 88134-07 for ; Tue, 6 Apr 2004 12:17:05 -0300 (ADT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id BF24DD1ED3D for ; Tue, 6 Apr 2004 12:17:04 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i36FH483024889; Tue, 6 Apr 2004 11:17:04 -0400 (EDT) To: Robert Treat Cc: pgsql-sql@postgresql.org Subject: Re: partial unique constraint In-reply-to: <1081261772.31785.48.camel@camel> References: <1081261772.31785.48.camel@camel> Comments: In-reply-to Robert Treat message dated "06 Apr 2004 10:29:32 -0400" Date: Tue, 06 Apr 2004 11:17:03 -0400 Message-ID: <24888.1081264623@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200404/37 X-Sequence-Number: 17412 Robert Treat writes: > Trying to come up with the proper syntax to meet the following criteria: > create table foo (bar integer, baz boolean UNIQUE (bar, baz = true)); The correct way to do it is with a separate CREATE INDEX command: create table foo (bar integer, baz boolean); create unique index fooi on foo (bar) where baz = true; Personally I'd spell that last as just "where baz" ... regards, tom lane