Re: What is the good equivalent for ENUM ? - Mailing list pgsql-general

From Bruce Momjian
Subject Re: What is the good equivalent for ENUM ?
Date
Msg-id 200309032305.h83N5ub11898@candle.pha.pa.us
Whole thread Raw
In response to Re: What is the good equivalent for ENUM ?  (Ron Johnson <ron.l.johnson@cox.net>)
Responses Re: What is the good equivalent for ENUM ?  (Ron Johnson <ron.l.johnson@cox.net>)
List pgsql-general
Ron Johnson wrote:
> On Wed, 2003-09-03 at 09:50, Vivek Khera wrote:
> > >>>>> "SD" == Shridhar Daithankar <shridhar_daithankar@persistent.co.in> writes:
> >
> > SD> On 3 Sep 2003 at 14:30, Bruno BAGUETTE wrote:
> > >> The problem is that this MySQL database uses ENUM, do you see what can I
> > >> do to migrate ENUM into PostgreSQL ?
> >
> > SD> varchar with check constraints. Add constraits to allow only
> > SD> certain values of varchar string.
> >
> > I used to do this.  It turns out to be horribly inflexible when you
> > need to alter the enum values since the constraints cannot easily be
> > changed.
>
> It'll be better when domains have alterable constraints.  Your
> way is the traditional (and best, IMO) way, though.

In 7.4 we have:

    Add DOMAIN CHECK constraints (Rod)
    Add ALTER DOMAIN .. SET / DROP NOT NULL, SET / DROP DEFAULT, ADD / DROP
      CONSTRAINT (Rod)

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

pgsql-general by date:

Previous
From: elein
Date:
Subject: Re: CPAN, P for postgresql [Re: LAST_DAY Function in Postgres]
Next
From: Bruce Momjian
Date:
Subject: Re: Localization (for dates) Oracle vs. Postgresql