Re: Best way to use indexes for partial match at beginning

Поиск
Список
Период
Сортировка
Искать
От
Jaime Casanova
Тема
Re: Best way to use indexes for partial match at beginning
Дата
Msg-id
c2d9e70e0511091423i7a343471g6387875538b52064@mail.gmail.com
Ответ на
Список
Дерево обсуждения
Re: Best way to use indexes for partial match at "Andrus" <eetasoft@online.ee>
Re: Best way to use indexes for partial match at Tom Lane <tgl@sss.pgh.pa.us>
On 11/9/05, Andrus  wrote:
> >> CREATE TABLE foo ( bar CHAR(10)  PRIMARY KEY);
> >>
> >> Cluster locale is non-C. Database encoding is UTF-8. Postgres vers is 8.1
>
> >Do this instead:
>
> >CREATE TABLE foo ( bar CHAR(10) NOT NULL );
> >CREATE UNIQUE INDEX foo_bar ON foo(bar char_pattern_ops);
>
> Martijn,
>
> Thank you. I have CHAR columns and need a primary key also. So I tried the
> code
>
> CREATE TABLE foo ( bar CHAR(10) NOT NULL );
> CREATE UNIQUE INDEX foo_bar ON foo(bar bpchar_pattern_ops);
> ALTER TABLE foo ADD PRIMARY KEY (bar);
>
> I found that adding primary key creates another index.
>
> How to create primary key without duplicate index on bar column ?
>
> Andrus.
>
>

you can't.
postgresql implements primary keys creating unique indexes and not
null constraints on the pk columns.

--
Atentamente,
Jaime Casanova
(DBA: DataBase Aniquilator ;)
В списке pgsql-general по дате отправления
От: Tom Lane
Дата:
Сообщение: Re: build errors on MacOSX
От: Scott Marlowe
Дата:
FAQ