Re: ADD CONSTRAINT UNIQUE patch

Lists: pgsql-patches
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
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

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

I haven't seen any replies to this patch - anything?

Chris

> -----Original Message-----
> From: pgsql-patches-owner(at)postgresql(dot)org
> [mailto:pgsql-patches-owner(at)postgresql(dot)org]On Behalf Of Christopher
> Kings-Lynne
> Sent: Friday, 24 August 2001 9:41 AM
> To: Patches
> Subject: [PATCHES] ADD CONSTRAINT UNIQUE patch
>
>
> 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
>


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: ADD CONSTRAINT UNIQUE patch
Date: 2001-08-30 22:59:47
Message-ID: 200108302259.f7UMxlI10767@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


Your patch has been added to the PostgreSQL unapplied patches list at:

http://candle.pha.pa.us/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

> 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, skipping... ]

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: ADD CONSTRAINT UNIQUE patch
Date: 2001-09-07 21:57:51
Message-ID: 200109072157.f87LvpA00654@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


Patch applied. Thanks.

> 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, skipping... ]

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026