Re: unique in two not so unique columns

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: unique in two not so unique columns
Дата
Msg-id 20021102084316.GD2571@svana.org
обсуждение исходный текст
Ответ на unique in two not so unique columns  ("Thomas T. Thai" <tom@minnesota.com>)
Список 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.

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: "Thomas T. Thai"
Дата:
Сообщение: unique in two not so unique columns
Следующее
От: Tino Wildenhain
Дата:
Сообщение: Re: unique in two not so unique columns