Re: CHECK Constraint Deferrable - Mailing list pgsql-hackers

From Robert Haas
Subject Re: CHECK Constraint Deferrable
Date
Msg-id CA+TgmoZWiyrJLKuHcPbaJsgr39jn05BuuB2c9xSv6RxnR6k_sA@mail.gmail.com
Whole thread Raw
In response to Re: CHECK Constraint Deferrable  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Mon, Oct 2, 2023 at 10:25 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> But here we have a
> feature whose only possible use is with constraints that *aren't*
> immutable; else we might as well just check them immediately.

I'm a little bit confused by this whole discussion because surely this
statement is just completely false. The example in the original post
demonstrates that clearly.

The use case for a deferred check constraint is exactly the same as
the use case for a deferred foreign key constraint or a deferred
uniqueness constraint, which is that you might have a constraint that
will be temporarily false while the transaction is in progress, but
true by the time the transaction actually commits, and you might like
the transaction to succeed instead of failing in such a case. You seem
to be imagining that the constraint itself might be returning mutable
answers on the same inputs, but that's not what this is about at all.

I'm not here - at least, not right now - to take a position on whether
the patch itself is any good.

--
Robert Haas
EDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: New WAL record to detect the checkpoint redo location
Next
From: Andres Freund
Date:
Subject: Re: New WAL record to detect the checkpoint redo location