Re: Migrating a MySQL schema with an enum

From: Martín Marqués <martin(at)bugs(dot)unl(dot)edu(dot)ar>
To: "SQL" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Migrating a MySQL schema with an enum
Date: 2002-03-21 11:43:40
Message-ID: 20020321114341.6FD67FA1D@bugs.unl.edu.ar
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Mié 20 Mar 2002 23:31, you wrote:
> > Keith Gray writes:
> > > Migrating a MySQL schema with an enum to PostgreSQL,
> > > is there an equivalent type or do I have to declare
> > > another table for "enum" values.
> >
> > Generally, you'd use a text field with a check constraint. For example:
> >
> > CREATE TABLE car (
> > ...
> > color text check (color in ('blue', 'green', 'yellow')),
> > ...
> > );
>
> Nope - cos you need 'blue,green' as a value, etc. as well.

That's not how enum() works.

--
Porqué usar una base de datos relacional cualquiera,
si podés usar PostgreSQL?
-----------------------------------------------------------------
Martín Marqués | mmarques(at)unl(dot)edu(dot)ar
Programador, Administrador, DBA | Centro de Telematica
Universidad Nacional
del Litoral
-----------------------------------------------------------------

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Johny Jugianto 2002-03-21 11:46:50 [OOT] timestamp / time ('now') in postgresql 7.2?
Previous Message Martín Marqués 2002-03-21 11:31:44 Re: Migrating a MySQL schema with an enum