Re: [SQL] ENUM Type

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: [SQL] ENUM Type
Дата
Msg-id Pine.LNX.4.21.0003040400040.489-100000@localhost.localdomain
обсуждение исходный текст
Ответ на ENUM Type  (Kyle Bateman <kyle@actarg.com>)
Список 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 по дате отправления:

Предыдущее
От: Annamalai G
Дата:
Сообщение: dayname()
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: [SQL] Strange error message with 7.0beta1