Re: [GENERAL] PG 9.1 - FK + Check constraint

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: [GENERAL] PG 9.1 - FK + Check constraint
Дата
Msg-id CAKFQuwanmBOH27hc3KKo7LUDWXwjSumYX2+5EFAOZdnVofa_Qg@mail.gmail.com
обсуждение исходный текст
Ответ на [GENERAL] PG 9.1 - FK + Check constraint  (Patrick B <patrickbakerbr@gmail.com>)
Список pgsql-general
On Tue, Jul 18, 2017 at 6:56 PM, Patrick B <patrickbakerbr@gmail.com> wrote:

Another solution would be to create an IMMUTABLE functiondoing the check and use that in a CHECK constraint [1].

Why do you need an FK constraint?  Why can you not use a data modification trigger?

Placing the subquery within a mis-defined immutable function so PostgreSQL is oblivious to it doesn't do anything to overcome the fact that the system is not designed to have check constraints with subqueries.  You are likely to get burned - commonly during backup restoration but there is no guarantees as to why might happen.

David J.



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

Предыдущее
От: Patrick B
Дата:
Сообщение: [GENERAL] PG 9.1 - FK + Check constraint
Следующее
От: armand pirvu
Дата:
Сообщение: [GENERAL] hash join performance question