Re: Question: unique on multiple columns

Поиск
Список
Период
Сортировка
Искать
От
Bruno Wolff III
Тема
Re: Question: unique on multiple columns
Дата
Msg-id
20030205165309.GB2542@wolff.to
Ответ на
Список
Дерево обсуждения
Question: unique on multiple columns roverr <roverr@dogpound.is-a-geek.org>
Re: Question: unique on multiple columns Arjen van der Meijden <acm@tweakers.net>
Re: Question: unique on multiple columns will trillich <will@serensoft.com>
Re: Question: unique on multiple columns roverr <roverr@dogpound.is-a-geek.org>
Re: Question: unique on multiple columns Richard Huxton <dev@archonet.com>
Re: Question: unique on multiple columns roverr <roverr@dogpound.is-a-geek.org>
Re: Question: unique on multiple columns Bruno Wolff III <bruno@wolff.to>
Re: Question: unique on multiple columns will trillich <will@serensoft.com>
Re: Question: unique on multiple columns Bruno Wolff III <bruno@wolff.to>
Re: Question: unique on multiple columns will trillich <will@serensoft.com>
On Wed, Feb 05, 2003 at 08:09:13 -0600,
  will trillich  wrote:
> On Wed, Feb 05, 2003 at 06:46:35AM -0500, roverr wrote:
> > I'm running postgresql 7.2.1.
> > Is there a way to specify a constraint such that the combination
> > of two columns in a table is unique?
> 
> 	create table something (
> 		a int4,
> 		b varchar(20),
> 		c timestamp
> 	);
> 	create unique index on something ( a, c );
> 	create unique index on something ( b, c, a );

While that will work, I think the following format is a little better.
 	create table something (
 		a int4,
 		b varchar(20),
 		c timestamp,
                unique(a,c),
                unique(b,c,a)
 	);
В списке pgsql-general по дате отправления
От: philip johnson
Дата:
Сообщение: how to configure my new server
От: Berend Tober
Дата:
FAQ