Re: Migrating a MySQL schema with an enum

Martin Marques <martin@bugs.unl.edu.ar>

From: Martín Marqués <martin@bugs.unl.edu.ar>
To: SQL <pgsql-sql@postgresql.org>
Date: 2002-03-21T11:31:44Z
Lists: pgsql-sql
On Mié 20 Mar 2002 20:41, you wrote:
> SQL gurus,
>
> 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.

I had to migrate a DB from MySQL to PostgreSQL that had some enum as field 
data type (I can't believe that something like that exists), and because it 
was something like:

enum('s','n')

I changed it for:

col1 CHAR CHECK (col1 IN ('s','n'))

Which is SQL. :-)

If what is enumerated are numbres, just use INT instead of CHAR.

Saludos... :-)

-- 
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
-----------------------------------------------------------------