On Tue, Jul 18, 2017 at 6:56 PM, Patrick B <patrickbake...@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.

Reply via email to