Re: Foreign key isolation tests
Paul A Jungwirth <pj@illuminatedcomputing.com>
From: Paul A Jungwirth <pj@illuminatedcomputing.com>
To: Álvaro Herrera <alvherre@kurilemu.de>
Cc: Robert Haas <robertmhaas@gmail.com>,
Dean Rasheed <dean.a.rasheed@gmail.com>, Rustam ALLAKOV <rustamallakov@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2025-09-11T16:54:54Z
Lists: pgsql-hackers
On Thu, Sep 11, 2025 at 9:30 AM Álvaro Herrera <alvherre@kurilemu.de> wrote:
> The wording of the last sentence (which you don't change) is a bit
> funny, because the macros aren't really to be used to check which
> isolation level is selected (which an interested observer could
> determine simply by looking at XactIsoLevel). What they do is implement
> a layer on top of the selected isolation level -- they are there to know
> which implementation to use depending on the isolation level.
>
> I also think that, for the explanation about serializable, we should
> change "in addition to snapshots" to "in addition to the snapshot",
> calling out the fact that the transaction will in fact use a single
> snapshot throughout.
>
> So how about something like this? (I include the macros in question so
> that we see exactly what we're talking about).
>
> /*
> * We implement three isolation levels internally.
> * The weakest uses one snapshot per statement;
> * the two stronger levels use one snapshot per database transaction.
> * Serializable uses predicate locks in addition to the snapshot.
> * These macros can be used to determine which implementation to use
> * depending on the prevailing serialization level.
> */
> #define IsolationUsesXactSnapshot() (XactIsoLevel >= XACT_REPEATABLE_READ)
> #define IsolationIsSerializable() (XactIsoLevel == XACT_SERIALIZABLE)
These all seem like improvements to me. Thanks for the review!
--
Paul ~{:-)
pj@illuminatedcomputing.com
Commits
-
Improve comment about snapshot macros
- 1d5800019f68 19 (unreleased) landed
-
Add test for temporal referential integrity
- e8cec3d1791c 19 (unreleased) landed
-
Fill testing gap for possible referential integrity violation
- a2b4102a21ad 19 (unreleased) landed
-
Simplify COALESCE() with one surviving argument.
- 931766aaec58 19 (unreleased) cited