Re: Using SUBSELECT in CHECK expressions

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Using SUBSELECT in CHECK expressions
Дата
Msg-id 25124.1067981198@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Using SUBSELECT in CHECK expressions  ("Najib Abi Fadel" <nabifadel@usj.edu.lb>)
Ответы Re: Using SUBSELECT in CHECK expressions
Список pgsql-general
"Najib Abi Fadel" <nabifadel@usj.edu.lb> writes:
> Is postgres going to support in a future release the use of SUBSELECT in a =
> CHECK expression ??

Not very likely.  To my mind, such a constraint would imply rechecking
whenever the table(s) read by the sub-SELECT change, not only when a
row of the constrained table changes.  I don't know any reasonably
efficient implementation of that behavior.  We might figure out how to
do it eventually, but don't hold your breath.

If you are satisfied with only a one-directional constraint (apply the
check just when the constrained table is modified), you can have it today.
Just put the SELECT into a function that's called by the CHECK
expression.

            regards, tom lane

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

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: Foreign Key to Inherited table
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: Using SUBSELECT in CHECK expressions