EVAL and SET equivalents in PostgreSQL

Поиск
Список
Период
Сортировка
От Lynn David Newton
Тема EVAL and SET equivalents in PostgreSQL
Дата
Msg-id cn1r8ildhbd.fsf@bela.interhack.net
обсуждение исходный текст
Ответы Re: EVAL and SET equivalents in PostgreSQL  (Bruce Momjian <pgman@candle.pha.pa.us>)
Re: EVAL and SET equivalents in PostgreSQL  (Frank Miles <fpm@u.washington.edu>)
Список pgsql-general
This is no doubt asked frequently, but I have exactly two days
experience with PostgreSQL, and am hot on a project for which I need a
more-or-less immediate answer.

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.

I need this functionality or something equivalent in a DB I'm setting
up on a project, and a half day of rumbling around in man pages and
printed documentation has yielded no obvious answer. I did learn about
creating arrays, but that's not exactly what I want.

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.

Without that, you have to add a layer of programming to intercept the
values that are coming in and verify that it's good stuff -- lots of
trouble that I'd like to avoid if possible.

I'm asking this group because I know that surely I am not the first
migrant from MySQL to come up against this problem, and suspect the
answer is common knowledge that I have not yet groked.

Many thanks for any insights shared.

--
Lynn David Newton
Phoenix, AZ

В списке pgsql-general по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Suppressing postgres messages?
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Truncation error