Re: Patch to add a primary key using an existing index

From: r t <pgsql(at)xzilla(dot)net>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>, Gurjeet Singh <singh(dot)gurjeet(at)gmail(dot)com>, Steve Singer <ssinger(at)ca(dot)afilias(dot)info>, Steve Singer <ssinger_pg(at)sympatico(dot)ca>, PGSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Patch to add a primary key using an existing index
Date: 2010-12-03 19:56:15
Message-ID: AANLkTi=cQWOO5YZ9iAcpppgnoku2n1qAU2et81ayVLNQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Dec 3, 2010 at 2:43 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:

> On Fri, Dec 3, 2010 at 2:23 PM, Peter Eisentraut <peter_e(at)gmx(dot)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(dot)takahiro(at)gmail(dot)com> wrote:
> >> > On Fri, Nov 26, 2010 at 05:58, Steve Singer <ssinger(at)ca(dot)afilias(dot)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.
>
>
+1 on this being confusing

> 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
>
> Other suggestions?

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. :-)

Robert Treat
play: http://www.xzilla.net
work: http://www.omniti.com/is/hiring

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2010-12-03 19:58:07 Re: Patch to add a primary key using an existing index
Previous Message Josh Berkus 2010-12-03 19:55:23 Re: We really ought to do something about O_DIRECT and data=journalled on ext4