Search Postgresql Archives

Re: Best way to use indexes for partial match at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread 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.
>
> 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. 



---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux