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

From Josh Berkus
Subject Re: Patch to add a primary key using an existing index
Date
Msg-id 4CF96418.1050700@agliodbs.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  (Robert Treat <rob@xzilla.net>)
List pgsql-hackers
On 12/3/10 12:27 PM, Robert Haas wrote:
> On Fri, Dec 3, 2010 at 2:56 PM, r t <pgsql@xzilla.net> wrote:
>> What exactly was the objection to the following -->
>> ALTER TABLE table_name ADD PRIMARY KEY (column_list) USING index_name;
>> Is the objection that you might have been trying to specify a constraint
>> named "using" ? I'm willing to make that option more difficult. :-)
> 
> I think it's that someone might expect the word after USING to be the
> name of an index AM.

Seems unlikely to cause confusion to me.

However, I don't see why we need (column_list). Surely the index has a
column list already?

ALTER TABLE table_name ADD CONSTRAINT pk_name PRIMARY KEY USING index_name

... seems like the syntax most consistent with the existing commands.
Anything else would be confusingly inconsistent with the way you add a
brand-new PK.

--                                  -- Josh Berkus                                    PostgreSQL Experts Inc.
                        http://www.pgexperts.com
 


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Patch to add a primary key using an existing index
Next
From: Oleg Bartunov
Date:
Subject: ERROR: could not identify an equality operator for type box