Re: unique in two not so unique columns - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: unique in two not so unique columns
Date
Msg-id 20021102084316.GD2571@svana.org
Whole thread Raw
In response to unique in two not so unique columns  ("Thomas T. Thai" <tom@minnesota.com>)
List pgsql-general
On Sat, Nov 02, 2002 at 12:58:34AM -0600, Thomas T. Thai wrote:
> I have two columns in a table:
>
> email     varchar(64)
> verified  boolean
>
> How do I make a check for unique email that is verified while allowing for
> non-verified emails to be not unique?

create unique index check_index on table(email) where verified = 't';

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> There are 10 kinds of people in the world, those that can do binary
> arithmetic and those that can't.

Attachment

pgsql-general by date:

Previous
From: "Thomas T. Thai"
Date:
Subject: unique in two not so unique columns
Next
From: Tino Wildenhain
Date:
Subject: Re: unique in two not so unique columns