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:31:44
Message-ID: 20020321113145.E84DBFA1D@bugs.unl.edu.ar
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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(at)unl(dot)edu(dot)ar
Programador, Administrador, DBA | Centro de Telematica
Universidad Nacional
del Litoral
-----------------------------------------------------------------

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Martín Marqués 2002-03-21 11:43:40 Re: Migrating a MySQL schema with an enum
Previous Message Peter Eisentraut 2002-03-21 04:50:48 Re: Migrating a MySQL schema with an enum