From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | "Jonah H(dot) Harris" <jonah(dot)harris(at)gmail(dot)com> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Setting a pre-existing index as a primary key |
Date: | 2008-05-10 01:50:23 |
Message-ID: | 200805100150.m4A1oNT28688@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Added to TODO:
o Allow an existing index to be marked as a table's primary key
---------------------------------------------------------------------------
Jonah H. Harris wrote:
> Hey all,
>
> 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. Unless I
> completely missed something, there's no way to do this now without a
> bit of catalog hackery.
>
> My implementation idea is as follows:
>
> Proposed Syntax (based on Oracle's syntax)
>
> ALTER TABLE foo ADD CONSTRAINT bar PRIMARY KEY USING INDEX schema.tablename;
>
> Proposed Implementation
>
> 1. Verify that the index named is a unique index
> 2. Check index columns for NOT NULL constraints
> 3. If indexed columns are not already NOT NULL, apply NOT NULL
> 4. If NOT NULL succeeds, complete the operation (catalogs,
> dependencies, ...), else bail out.
>
> Any comments, ideas, suggestions?
>
> --
> 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/
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Hodges | 2008-05-10 01:59:53 | Re: Deterministic locking in PostgreSQL |
Previous Message | Bruce Momjian | 2008-05-10 01:32:17 | Re: Database owner installable modules patch |