Re: Need to check each element of an array satisfies a foreign key constraint

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Need to check each element of an array satisfies a foreign key constraint
Дата
Msg-id CAKFQuwZfnYjT372qenVQsmj4JdpgKrHdzC6iAxEyBc=TvHqH-A@mail.gmail.com
обсуждение исходный текст
Ответ на Need to check each element of an array satisfies a foreign key constraint  (David Gauthier <davegauthierpg@gmail.com>)
Ответы Re: Need to check each element of an array satisfies a foreign key constraint  (David Gauthier <davegauthierpg@gmail.com>)
Список pgsql-general
On Tuesday, July 13, 2021, David Gauthier <davegauthierpg@gmail.com> wrote:

I suppose I could write a stored procedure to do this and call it in a check constraint. But I was wondering if there is something more elegant.


You cannot use a check constraint here as the behavior is not immutable.  You can use a trigger function though.  Or normalize the table and use the built-it foreign key triggers.

David J.
 

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

Предыдущее
От: David Gauthier
Дата:
Сообщение: Need to check each element of an array satisfies a foreign key constraint
Следующее
От: David Gauthier
Дата:
Сообщение: Re: Need to check each element of an array satisfies a foreign key constraint