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

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Treat <rob(at)xzilla(dot)net>, "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Patch to add a primary key using an existing index
Date: 2010-12-04 20:37:43
Message-ID: 8C99A20F-9118-45CA-B97C-FC5307EB56C7@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Dec 4, 2010, at 11:46 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Treat <rob(at)xzilla(dot)net> writes:
>> Actually I think I'd even be comfortable with A, either you must name the
>> constraint after the index, or you can leave the constraint name out, and
>> we'll use the index name.
>
> Or we could omit the "CONSTRAINT name" clause from the syntax
> altogether.
>
> I think that allowing the names to be different is a bad idea. That
> hasn't been possible in the past and there's no apparent reason why
> this feature should suddenly make it possible. We will have problems
> with it, for instance failures on name collisions because generated
> names are only checked against one catalog or the other.

So maybe we should start by deciding what the semantics should be, and then decide what syntax would convey those semantics.

What would make sense to me is: create a pk constraint with the sane name as the existing unique index. If that constraint name already exists, error.

...Robert

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dimitri Fontaine 2010-12-04 21:20:02 Re: knngist - 0.8
Previous Message David Fetter 2010-12-04 19:49:30 Re: FK's to refer to rows in inheritance child