Re: Subselects in CHECK clause ...

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: Subselects in CHECK clause ...
Дата
Msg-id 20061129094826.X4910@megazone.bigpanda.com
обсуждение исходный текст
Ответ на Subselects in CHECK clause ...  (James Robinson <jlrobins@socialserve.com>)
Ответы Re: Subselects in CHECK clause ...
Список pgsql-sql
On Wed, 29 Nov 2006, James Robinson wrote:

> I see that subselects are not directly supported in check clauses,
> but one can work around that by writing a stored function which
> returns boolean and performs the subselect. Are there any known
> gotchas with doing this?

To completely get the constraint, you have to also apply constraints on
the tables referenced in the function that prevent modifications on those
tables from causing the constraint to be violated. For example, if you
were to do an exists test on another table for a row that matches up with
this row in some fashion (for a specialized referential integrity
constraint) modifications on that other table could also cause the
constraint to be violated, but that isn't caught by the CHECK
function(...) case and you'll probably need triggers or other constraints
on that table.



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

Предыдущее
От: Jeff Herrin
Дата:
Сообщение: Re: consistent random order
Следующее
От: James Robinson
Дата:
Сообщение: Re: Subselects in CHECK clause ...