From: | "Merlin Moncure" <mmoncure(at)gmail(dot)com> |
---|---|
To: | dmitry(at)koterov(dot)ru |
Cc: | "Jeff Davis" <pgsql(at)j-davis(dot)com>, "D(dot) Dante Lorenso" <dante(at)lorenso(dot)com>, "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>, "Andreas 'ads' Scherbaum" <adsmail(at)wars-nicht(dot)de>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: How to modify ENUM datatypes? (The solution) |
Date: | 2008-08-13 00:25:25 |
Message-ID: | b42b73150808121725h7f0a3b50n3b72522a764a563a@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, Aug 12, 2008 at 5:40 PM, Dmitry Koterov <dmitry(at)koterov(dot)ru> wrote:
> Here is the solution about "on the fly" ALTER ENUM:
> http://en.dklab.ru/lib/dklab_postgresql_enum/
>
> Usage:
>
> -- Add a new element to the ENUM "on the fly".
>
> SELECT enum.enum_add('my_enum', 'third');
>
> -- Remove an element from the ENUM "on the fly".
> SELECT enum.enum_del('my_enum', 'first');
>
> Possibly future versions of PostgreSQL will include built-in ALTER TYPE for
> ENUM, all the more its implementation is not impossible, as you see above.
> Hope this will be helpful.
Decent user space solution...it's easy enough. IMO 'real' solution is
through alter type as you suggest. It's worth noting there there is
no handling for the unlikely but still possible event of oid
wraparound. Also, there is no 'enum_insert', which is not so pleasant
with how enums are implemented.
Also, is lgpl compatible with bsd licnese? Not that it matters, but I'm curious.
merlin
From | Date | Subject | |
---|---|---|---|
Next Message | Tim Uckun | 2008-08-13 02:18:17 | Is the primary key constraint also an index? |
Previous Message | Bart Grantham | 2008-08-12 23:51:51 | Alias for function return buffer in pl/pgsql? |