ADD CONSTRAINT UNIQUE patch

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Patches" <pgsql-patches(at)postgresql(dot)org>
Subject: ADD CONSTRAINT UNIQUE patch
Date: 2001-08-24 01:40:55
Message-ID: ECEHIKNFIMMECLEBJFIGAEKFCBAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Hi all,

Here is my much-promised patch to let people add UNIQUE constraints after
table creation time. Big deal you say - but this patch is the basis of the
next thing which is adding PRIMARY KEYs after table creation time. (Which
is currently impossible without twiddling catalogs)

Rundown
-------

* I have made the makeObjectName function of analyze.c non-static, and
exported it in analyze.h

* I have included analyze.h and defrem.h into command.c, to support
makingObjectNames and creating indices

* I removed the 'case CONSTR_PRIMARY' clause so that it properly fails and
says you can't add primary keys, rather than just doing nothing and
reporting nothing!!!

* I have modified the docs.

Algorithm
---------

* If name specified is null, search for a new valid constraint name. I'm
not sure if I should "lock" my generated name somehow tho - should I open
the relation before doing this step?

* Open relation in access exclusive mode

* Check that the constraint does not already exist

* Define the new index

* Warn if they're doubling up on an existing index

Chris

Attachment Content-Type Size
addunique.diff application/octet-stream 10.9 KB
addunique-doc.diff application/octet-stream 1.5 KB

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2001-08-24 01:48:17 Re: JDBC patch (attempt#2) for util.Serialize and jdbc2.PreparedStatement
Previous Message Robert B. Easter 2001-08-24 01:27:54 JDBC patch (attempt#2) for util.Serialize and jdbc2.PreparedStatement