>> > 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.
>
> But, of course, you CAN delete that other index now that it's redundant.
Scott,
thank you. I don't understand how to delete primary key index without
removing primary key constraint or how to force primary key to use foo_bar
index.
I tried
CREATE TABLE foo ( bar CHAR(10) PRIMARY KEY );
CREATE UNIQUE INDEX foo_bar ON foo(bar bpchar_pattern_ops);
DROP INDEX foo_pkey;
but got
ERROR: cannot drop index foo_pkey because constraint foo_pkey on table foo
requires it
Andrus.