Re: [SQL] ENUM Type

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Kyle Bateman <kyle(at)actarg(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] ENUM Type
Date: 2000-03-04 17:05:40
Message-ID: Pine.LNX.4.21.0003040400040.489-100000@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmx(dot)net 75262 Uppsala
http://yi.org/peter-e/ Sweden

In response to

  • ENUM Type at 2000-03-03 21:37:48 from Kyle Bateman

Browse pgsql-sql by date

  From Date Subject
Next Message Nikolaj Lundsgaard 2000-03-05 10:43:45 Left Join
Previous Message Peter Eisentraut 2000-03-04 17:05:34 Re: [SQL] Strange error message with 7.0beta1