pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Martín Marqués <martin@bugs.unl.edu.ar>
To: SQL <pgsql-sql@postgresql.org>
Subject: Re: Migrating a MySQL schema with an enum
Date: Thu, 21 Mar 2002 08:31:44 -0300
Message-ID: <20020321113145.E84DBFA1D@bugs.unl.edu.ar> (raw)
In-Reply-To: <3C991E29.C90559F4@heart.com.au>
References: <3C991E29.C90559F4@heart.com.au>

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



view thread (10+ messages)  latest in thread

Message-ID: <20020321113145.E84DBFA1D@bugs.unl.edu.ar>
Permalink:  ../20020321113145.E84DBFA1D@bugs.unl.edu.ar/
Also on:    postgresql.org/message-id/20020321113145.E84DBFA1D@bugs.unl.edu.ar

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: martin@bugs.unl.edu.ar
  Subject: Re: Migrating a MySQL schema with an enum
  In-Reply-To: <20020321113145.E84DBFA1D@bugs.unl.edu.ar>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox