Re: Patch to add a primary key using an existing index - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Patch to add a primary key using an existing index
Date
Msg-id 4CF948F7.60402@enterprisedb.com
Whole thread Raw
In response to Re: Patch to add a primary key using an existing index  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Patch to add a primary key using an existing index  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-hackers
On 03.12.2010 21:43, Robert Haas wrote:
> On Fri, Dec 3, 2010 at 2:23 PM, Peter Eisentraut<peter_e@gmx.net>  wrote:
>> On sön, 2010-11-28 at 20:40 -0500, Robert Haas wrote:
>>> On Sun, Nov 28, 2010 at 8:06 PM, Itagaki Takahiro
>>> <itagaki.takahiro@gmail.com>  wrote:
>>>> On Fri, Nov 26, 2010 at 05:58, Steve Singer<ssinger@ca.afilias.info>  wrote:
>>>>> The attached version of the patch gets your regression tests to pass.
>>>>> I'm going to mark this as ready for a committer.
>>>>
>>>> I think we need more discussions about the syntax:
>>>>   ALTER TABLE table_name ADD PRIMARY KEY (...) WITH (INDEX='index_name')
>>>
>>> Why not:
>>>
>>> ALTER TABLE table_name ADD PRIMARY KEY (...) INDEX index_name;
>>
>> I would think that that determines that name of the index that the
>> command creates.  It does not convey that an existing index is to be
>> used.
>
> Well, that'll become clear pretty quickly if you try to use it that
> way, but I'm certainly open to other ideas.
>
> Random thoughts:
>
> ALTER TABLE table_name SET PRIMARY KEY INDEX index_name
> ALTER INDEX index_name PRIMARY KEY

ALTER TABLE table_name SET PRIMARY KEY USING INDEX index_name. Quite 
verbose, but imho USING makes it much more clear that it's an existing 
index.

--   Heikki Linnakangas  EnterpriseDB   http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: On-the-fly index tuple deletion vs. hot_standby
Next
From: Josh Berkus
Date:
Subject: Re: We really ought to do something about O_DIRECT and data=journalled on ext4