Re: Migrating a MySQL schema with an enum

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Keith Gray <keith(at)heart(dot)com(dot)au>
Cc: SQL <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Migrating a MySQL schema with an enum
Date: 2002-03-21 00:02:21
Message-ID: Pine.LNX.4.30.0203201900010.812-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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')),
...
);

--
Peter Eisentraut peter_e(at)gmx(dot)net

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Christopher Kings-Lynne 2002-03-21 02:31:12 Re: Migrating a MySQL schema with an enum
Previous Message Bruce Momjian 2002-03-20 23:53:55 Re: Migrating a MySQL schema with an enum