Re: Migrating a MySQL schema with an enum - Mailing list pgsql-sql

From Peter Eisentraut
Subject Re: Migrating a MySQL schema with an enum
Date
Msg-id Pine.LNX.4.30.0203201900010.812-100000@peter.localdomain
Whole thread Raw
In response to Migrating a MySQL schema with an enum  (Keith Gray <keith@heart.com.au>)
Responses Re: Migrating a MySQL schema with an enum
List 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@gmx.net



pgsql-sql by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Migrating a MySQL schema with an enum
Next
From: "Christopher Kings-Lynne"
Date:
Subject: Re: Migrating a MySQL schema with an enum