Re: Add a check an a array column

Поиск
Список
Период
Сортировка
От Andreas Kretschmer
Тема Re: Add a check an a array column
Дата
Msg-id 20120908192414.GA24230@tux
обсуждение исходный текст
Ответ на Re: Add a check an a array column  (Joel Hoffman <joel.hoffman@gmail.com>)
Ответы Re: Add a check an a array column
Список pgsql-general
Joel Hoffman <joel.hoffman@gmail.com> wrote:

> More concisely, you can compare directly against all values of the array:
>
> # create table i (i int[] check (0 <= ALL(i) AND 1023 >= ALL(i)));
> # insert into i values (ARRAY[0,1,2,3,1023]);
> # insert into i values (ARRAY[0,1,2,3,-1]);
> ERROR:  new row for relation "i" violates check constraint "i_i_check"

Nice! Didn't know that with all()


Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."   (unknown)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°


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

Предыдущее
От: Misa Simic
Дата:
Сообщение: Re: [GENERAL] INSERT… RETURNING for copying records
Следующее
От: Bret Stern
Дата:
Сообщение: Re: Add a check an a array column