Re: Best way to use indexes for partial match at - Mailing list pgsql-general

From Andrus
Subject Re: Best way to use indexes for partial match at
Date
Msg-id dkv440$1424$1@news.hub.org
Whole thread Raw
In response to Best way to use indexes for partial match at beginning  ("Andrus Moor" <eetasoft@online.ee>)
Responses Re: Best way to use indexes for partial match at  (Peter Eisentraut <peter_e@gmx.net>)
Re: Best way to use indexes for partial match at  (Scott Marlowe <smarlowe@g2switchworks.com>)
List pgsql-general
>> > 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.



pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: Postmaster failing to start on reboot
Next
From: Martijn van Oosterhout
Date:
Subject: Re: PL language selection