Re: CHECK Constraints

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: CHECK Constraints
Дата
Msg-id 20050422163705.GB4347@wolff.to
обсуждение исходный текст
Ответ на CHECK Constraints  ("Van Ingen, Lane" <lvaningen@ESNCC.com>)
Список pgsql-novice
On Fri, Apr 22, 2005 at 12:02:41 -0400,
  "Van Ingen, Lane" <lvaningen@ESNCC.com> wrote:
> Hi all,
>   the 8.0 manual says CHECK can be used in the following manner:
>        CHECK (expression)
> The only stipulations are that it must produce a boolean result (true or unknown) to succeed.
>
> If I were to specify a the following on a field named price in one expression, would it succeed?
>      CHECK (price = 1 OR price = 2 OR price = 3)
>
> In other words, I would want to raise an exception on any other value other than 1, 2, or 3. Can
> this be done? All of the examples in the manual show a single check (like price > 0) .

Yes, you can do that.

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

Предыдущее
От: "Walker, Jed S"
Дата:
Сообщение: Re: Authorized privileges when calling a procedure
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: CHECK Constraints