From: Bryn Llewellyn <bryn@yugabyte.com>
To: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: pgsql-general list <pgsql-general@lists.postgresql.org>
Subject: Re: Deferred constraint trigger semantics
Date: Thu, 12 May 2022 23:43:51 -0700
Message-ID: <5F2AF0A2-DF85-42DF-A2C1-EBEB03E54F8F@yugabyte.com> (raw)
In-Reply-To: <4e2de8ec77447a8347ea1923171afb6bcf77397b.camel@cybertec.at>
References: <5C29B392-6215-4791-8DD8-7B8977A637B7@yugabyte.com>
<ce0577e66d4365f966ab0b39ec61b8720dbe7d18.camel@cybertec.at>
<987A57EE-C893-43EE-BFF0-FAF1422526D4@yugabyte.com>
<356843a91b48918d8e78d2accb932a46b7889161.camel@cybertec.at>
<E6AE4872-5164-49F8-999A-0DC6C63CAA03@yugabyte.com>
<4e2de8ec77447a8347ea1923171afb6bcf77397b.camel@cybertec.at>
> laurenz.albe@cybertec.at wrote:
>
> Be "seeing" I didn't mean "show to the user". I mean that the code that implements PostgreSQL constraints takes uncommitted data into account.
>
> The documentation describes that for the case of uniqueness in some detail:
>
> https://www.postgresql.org/docs/current/index-unique-checks.html
>
> I'd say that the proper mental model is that you don't need to care. The ACID properties are guarantees that the database makes, and these guarantees are usually negative: "no sequence of actions can result in the violation of a unique constraint" or "you don't get to see uncommitted data".
>
> The exact sequence of what happens during COMMIT is interesting, but irrelevant to the programmer. All that counts is "a deferred constraint is checked between the time that COMMIT starts processing and the time that it returns".
>
> If you want to know more, you have to start reading the code. It is open source and well documented.
Thanks for the quick reply, Laurenz. I'm signing off now (US/Pacific) for a long weekend. I'll try to digest what you wrote on Monday.=
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: bryn@yugabyte.com, laurenz.albe@cybertec.at
Subject: Re: Deferred constraint trigger semantics
In-Reply-To: <5F2AF0A2-DF85-42DF-A2C1-EBEB03E54F8F@yugabyte.com>
References: <5C29B392-6215-4791-8DD8-7B8977A637B7@yugabyte.com> <ce0577e66d4365f966ab0b39ec61b8720dbe7d18.camel@cybertec.at> <987A57EE-C893-43EE-BFF0-FAF1422526D4@yugabyte.com> <356843a91b48918d8e78d2accb932a46b7889161.camel@cybertec.at> <E6AE4872-5164-49F8-999A-0DC6C63CAA03@yugabyte.com> <4e2de8ec77447a8347ea1923171afb6bcf77397b.camel@cybertec.at> <5F2AF0A2-DF85-42DF-A2C1-EBEB03E54F8F@yugabyte.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox