| From: | Alvaro Herrera <alvherre(at)atentus(dot)com> |
|---|---|
| To: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
| Cc: | Lynn David Newton <lynn(dot)newton(at)cox(dot)net>, <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: EVAL and SET equivalents in PostgreSQL |
| Date: | 2002-07-04 03:19:22 |
| Message-ID: | Pine.LNX.4.44.0207032303150.7246-100000@cm-lcon-46-187.cm.vtr.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2002-07-04 04:23:17 | Re: I am being interviewed by OReilly |
| Previous Message | Lee Harr | 2002-07-04 03:08:15 | Re: epoch from date field |