Re: Migrating a MySQL schema with an enum - Mailing list pgsql-sql

From Martín Marqués
Subject Re: Migrating a MySQL schema with an enum
Date
Msg-id 20020321114341.6FD67FA1D@bugs.unl.edu.ar
Whole thread Raw
In response to Re: Migrating a MySQL schema with an enum  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
List 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@unl.edu.ar
Programador, Administrador, DBA |       Centro de Telematica                      Universidad Nacional
        del Litoral
 
-----------------------------------------------------------------


pgsql-sql by date:

Previous
From: Martín Marqués
Date:
Subject: Re: Migrating a MySQL schema with an enum
Next
From: "Johny Jugianto"
Date:
Subject: [OOT] timestamp / time ('now') in postgresql 7.2?