Re: EVAL and SET equivalents in PostgreSQL
| От | Alvaro Herrera |
|---|---|
| Тема | Re: EVAL and SET equivalents in PostgreSQL |
| Дата | |
| Msg-id | Pine.LNX.4.44.0207032303150.7246-100000@cm-lcon-46-187.cm.vtr.net обсуждение исходный текст |
| Ответ на | Re: EVAL and SET equivalents in PostgreSQL (Bruce Momjian <pgman@candle.pha.pa.us>) |
| Ответы |
Re: EVAL and SET equivalents in PostgreSQL
|
| Список | pgsql-general |
Bruce Momjian dijo:
> Sure, use CHECK constraints on the column. That is the ANSI standard
> way.
>
> gender CHAR(1) CHECK (gender IN ('M','F')),
That's the solution for the ENUM MySQL datatype, but the SET datatype
allows one to have multiple values in the column (or that's what I
understood in the original message).
In PostgreSQL, you could use an array to store multiple values. I don't
know if one could set up a CHECK constraint so that every element in a
varchar array is checked against a predefined set. Maybe it can be done
at insertion time using a trigger?
--
Alvaro Herrera (<alvherre[a]atentus.com>)
"Ninguna manada de bestias tiene una voz tan horrible como la humana" (Orual)
В списке pgsql-general по дате отправления: