partial unique constraint - Mailing list pgsql-sql

From Robert Treat
Subject partial unique constraint
Date
Msg-id 1081261772.31785.48.camel@camel
Whole thread Raw
Responses Re: partial unique constraint  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: partial unique constraint  (Achilleus Mantzios <achill@matrix.gatewaynet.com>)
Re: partial unique constraint  (<ries@jongert.nl>)
Re: partial unique constraint  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Re: partial unique constraint  (Paul Thomas <paul@tmsl.demon.co.uk>)
Re: partial unique constraint  (Rod Taylor <rbt@rbt.ca>)
List pgsql-sql
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



pgsql-sql by date:

Previous
From: Jeff Eckermann
Date:
Subject: Re: Entered data appears TWICE in table!!?
Next
From: Tom Lane
Date:
Subject: Re: could not devise a query plan