Re: Setting a pre-existing index as a primary key

From: "Jonah H(dot) Harris" <jonah(dot)harris(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Setting a pre-existing index as a primary key
Date: 2008-04-09 03:03:38
Message-ID: 36e682920804082003m5d3fba19y3d500944cd1cbeda@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Apr 8, 2008 at 9:04 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> "Jonah H. Harris" <jonah(dot)harris(at)gmail(dot)com> writes:
> > I've run into a couple cases now where it would be helpful to easily
> > assign an already-existing unique index as a primary key.
>
> You need to present a more convincing use-case than this unsupported
> assertion. There's hardly any effective difference between a unique
> index + NOT NULL constraints and a declared primary key ... so what
> did you really need it for?

Agreed, functionally there's not much of a difference. It's more of a
matter of proper design identifying a primary key.

> > 1. Verify that the index named is a unique index
>
> ... and not partial, and not on expressions, and not invalid, and not
> using non-default opclasses (which might have a surprising definition of
> "equal"), and not already owned by a constraint ... not to mention that
> it'd better be an index on the named table, which among other things
> removes the need for a schema specification on the index name.

Of course.

--
Jonah H. Harris, Sr. Software Architect | phone: 732.331.1324
EnterpriseDB Corporation | fax: 732.331.1301
499 Thornall Street, 2nd Floor | jonah(dot)harris(at)enterprisedb(dot)com
Edison, NJ 08837 | http://www.enterprisedb.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2008-04-09 03:12:56 Re: File system snapshots for multiple file systems
Previous Message Merlin Moncure 2008-04-09 02:47:17 Re: [PATCHES] libpq type system 0.9a