From: | Frank Miles <fpm(at)u(dot)washington(dot)edu> |
---|---|
To: | Lynn David Newton <lynn(dot)newton(at)cox(dot)net> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: EVAL and SET equivalents in PostgreSQL |
Date: | 2002-07-03 22:19:02 |
Message-ID: | Pine.A41.4.44.0207031517050.50304-100000@mead4.u.washington.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, 2 Jul 2002, Lynn David Newton wrote:
> [snip]
>
> Most of my previous DB experience has been with MySQL, which supported
> ENUM('value1','value2'...) data types, to allow a column to be
> assigned the value of exactly one item from the list, and also the
> SET('value1','value2',...) type to allow zero or more members of the
> set of values.
>
> [snip]
>
> If I try to INSERT an illegel value for a SET or ENUM field, MySQL
> will return an error message, which is what you want it to do.
Have you looked at or tried the CHECK constraint? See the SQL code
for CREATE TABLE ...
If you need something more flexible, you can use an auxiliary table
to store the "enum" values, and use a foreign key constraint.
HTH --
-frank
From | Date | Subject | |
---|---|---|---|
Next Message | Lynn David Newton | 2002-07-03 22:41:09 | Re: EVAL and SET equivalents in PostgreSQL |
Previous Message | Bruce Momjian | 2002-07-03 21:49:31 | Re: Suppressing postgres messages? |