Re: EVAL and SET equivalents in PostgreSQL

Поиск
Список
Период
Сортировка
От Frank Miles
Тема Re: EVAL and SET equivalents in PostgreSQL
Дата
Msg-id Pine.A41.4.44.0207031517050.50304-100000@mead4.u.washington.edu
обсуждение исходный текст
Ответ на EVAL and SET equivalents in PostgreSQL  (Lynn David Newton <lynn.newton@cox.net>)
Ответы Re: EVAL and SET equivalents in PostgreSQL  (Lynn David Newton <lynn.newton@cox.net>)
Список 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 по дате отправления:

Предыдущее
От: "Peter Darley"
Дата:
Сообщение: Re: Bad records in table
Следующее
От: Sean Chittenden
Дата:
Сообщение: Re: temporal event