Re: WIP: extensible enums

From: Thom Brown <thom(at)linux(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: WIP: extensible enums
Date: 2010-08-23 18:09:12
Message-ID: AANLkTimSZ7kTbvA7dNYfvpYF0OgXj07qGca_iZoao_OW@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 23 August 2010 10:35, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
>
> Attached is a WIP patch that allows enums to be extended with additional
> labels arbitrarily. As previously discussed, it works by adding an explicit
> sort order column to pg_enum. It keeps track of whether the labels are
> correctly sorted by oid value, and if so uses that for comparison, so the
> possible performance impact on existing uses, and on almost all cases where
> a label is added at the end of the list, should be negligible.
>
> Open items include
>
>   * some additional error checking required
>   * missing documentation
>   * pg_upgrade considerations
>
>
> To add a label at the end of the list, do:
>
>  ALTER TYPE myenum ADD 'newlabel';
>
> To add a label somewhere else, do:
>
>  ALTER TYPE myenum ADD 'newlabel' BEFORE 'existinglabel';
>
> or
>
>  ALTER TYPE myenum ADD 'newlabel' AFTER 'existinglabel';
>
>
> I'm not wedded to the syntax. Let the bikeshedding begin.
>
> cheers
>
> andrew

When you write the supporting doc changes, you might want to add a
note in to mention that you cannot remove a label once it has been
added.

Will the modified enums remain intact after a dump/restore?

--
Thom Brown
Registered Linux user: #516935

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2010-08-23 18:13:07 Re: WIP: extensible enums
Previous Message Cristian Bittel 2010-08-23 18:07:27 Re: [BUGS] BUG #5305: Postgres service stops when closing Windows session