pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Treat <xzilla@users.sourceforge.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: partial unique constraint
Date: Tue, 06 Apr 2004 11:17:03 -0400
Message-ID: <24888.1081264623@sss.pgh.pa.us> (raw)
In-Reply-To: <1081261772.31785.48.camel@camel>
References: <1081261772.31785.48.camel@camel>

Robert Treat <xzilla@users.sourceforge.net> 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



view thread (9+ messages)  latest in thread

Message-ID: <24888.1081264623@sss.pgh.pa.us>
Permalink:  ../24888.1081264623@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/24888.1081264623@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, xzilla@users.sourceforge.net
  Subject: Re: partial unique constraint
  In-Reply-To: <24888.1081264623@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox