Re: EVAL and SET equivalents in PostgreSQL - Mailing list pgsql-general

From Frank Miles
Subject Re: EVAL and SET equivalents in PostgreSQL
Date
Msg-id Pine.A41.4.44.0207031517050.50304-100000@mead4.u.washington.edu
Whole thread Raw
In response to EVAL and SET equivalents in PostgreSQL  (Lynn David Newton <lynn.newton@cox.net>)
Responses Re: EVAL and SET equivalents in PostgreSQL
List 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




pgsql-general by date:

Previous
From: "Peter Darley"
Date:
Subject: Re: Bad records in table
Next
From: Sean Chittenden
Date:
Subject: Re: temporal event