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:43:40 -0300
Message-ID: <20020321114341.6FD67FA1D@bugs.unl.edu.ar> (raw)
In-Reply-To: <GNELIHDDFBOCMGBFGEFOAENACBAA.chriskl@familyhealth.com.au>
References: <GNELIHDDFBOCMGBFGEFOAENACBAA.chriskl@familyhealth.com.au>

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



view thread (10+ messages)  latest in thread

Message-ID: <20020321114341.6FD67FA1D@bugs.unl.edu.ar>
Permalink:  ../20020321114341.6FD67FA1D@bugs.unl.edu.ar/
Also on:    postgresql.org/message-id/20020321114341.6FD67FA1D@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: <20020321114341.6FD67FA1D@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