Re: Best way to use indexes for partial match at

From: "Andrus" <eetasoft(at)online(dot)ee>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Best way to use indexes for partial match at
Date: 2005-11-10 09:19:44
Message-ID: dkv440$1424$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2005-11-10 09:23:56 Re: Dynamic web sites with PostgreSQL
Previous Message Nicolay A Vasiliev 2005-11-10 09:16:12 PL language selection