Re: subselect in CHECK constraint?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: subselect in CHECK constraint?
Дата
Msg-id 14579.968087411@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: subselect in CHECK constraint?  (Ian Turner <vectro@pipeline.com>)
Ответы Re: subselect in CHECK constraint?  (Ian Turner <vectro@pipeline.com>)
Список pgsql-general
Ian Turner <vectro@pipeline.com> writes:
> Uhhh. I get no errors, but it dosen't work, either. Consider:

I didn't say that you would like the semantics ;-).

The check constraint is going to be evaluated *before* the proposed
new tuple is inserted into the table, not after; so doing a select
on the same table won't see the new tuple.

Also, as several other people already pointed out, a constraint
involving a select could be violated in many ways including alteration
or removal of tuples in other tables.  We only evaluate check
constraints when we insert/update tuples in the table they are attached
to...

            regards, tom lane

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

Предыдущее
От: Ian Turner
Дата:
Сообщение: Re: subselect in CHECK constraint?
Следующее
От: "Rafa Couto"
Дата:
Сообщение: RE: Postgres 7.0.2 and ODBC