Re: [SQL] ENUM Type - Mailing list pgsql-sql

From Peter Eisentraut
Subject Re: [SQL] ENUM Type
Date
Msg-id Pine.LNX.4.21.0003040400040.489-100000@localhost.localdomain
Whole thread Raw
In response to ENUM Type  (Kyle Bateman <kyle@actarg.com>)
List pgsql-sql
Kyle Bateman writes:

> Does PostgreSQL have support for an ENUM type?

No. You can create a separate table that maps some, say integer, key to a,
say, string. That's usually how ENUM stuff is ported away from MySQL (also
known as TheirSQL). Alternatively you can also pull something like this:

CREATE TABLE test (   ...   a text check (a in ('value1', 'value2', ...)),   ...
)

You get the idea.

> I didn't see it in the docs, but maybe someone has figured out how to
> create one easily with the add new type stuff...

That "add new type stuff" isn't all one might think it is either.

-- 
Peter Eisentraut                  Sernanders väg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden



pgsql-sql by date:

Previous
From: Annamalai G
Date:
Subject: dayname()
Next
From: Peter Eisentraut
Date:
Subject: Re: [SQL] Strange error message with 7.0beta1