Re: What is the good equivalent for ENUM ?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>
Cc: PgSQL General ML <pgsql-general(at)postgresql(dot)org>
Subject: Re: What is the good equivalent for ENUM ?
Date: 2003-09-03 23:05:56
Message-ID: 200309032305.h83N5ub11898@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ron Johnson wrote:
> On Wed, 2003-09-03 at 09:50, Vivek Khera wrote:
> > >>>>> "SD" == Shridhar Daithankar <shridhar_daithankar(at)persistent(dot)co(dot)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(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2003-09-03 23:14:35 Re: Dumping select tables (omitting tables)
Previous Message elein 2003-09-03 23:04:45 Re: CPAN, P for postgresql [Re: LAST_DAY Function in Postgres]