Re: Question: unique on multiple columns

Поиск
Список
Период
Сортировка
От will trillich
Тема Re: Question: unique on multiple columns
Дата
Msg-id 20030206163351.GA17263@mail.serensoft.com
обсуждение исходный текст
Ответ на Re: Question: unique on multiple columns  (Bruno Wolff III <bruno@wolff.to>)
Ответы Re: Question: unique on multiple columns
Список pgsql-general
On Wed, Feb 05, 2003 at 10:53:09AM -0600, Bruno Wolff III wrote:
> On Wed, Feb 05, 2003 at 08:09:13 -0600,
>   will trillich <will@serensoft.com> wrote:
> >     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)
>      );

i like it. see what happens when you have to read the manual for
configuring apache and exim in the same week? it shoves out
previously-gained knowledge. :)

i also like specifying "primary key" at the bottom of the table
def. keeps commas after all the field defs, making it easier to
move whole lines around.

of course, my example is rather bogus -- as others pointed out,
unique(a,c) means that there'll only be 1 b for any a/c pair, so
the unique(b...) index is not-too-useful. it's just an
illustration, and a bad one at that. ah, well...

--
There are 10 kinds of people:
ones that get binary, and ones that don't.

will@serensoft.com
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

Looking for a firewall? Do you think smoothwall sucks? You're
probably right... Try the folks at http://clarkconnect.org/ !

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

Предыдущее
От: Dennis Gearon
Дата:
Сообщение: Re: Pg_dumpall problem
Следующее
От: Arjen van der Meijden
Дата:
Сообщение: Re: password() function?