Re: [PATCH] Attempt to clarify example of serialization anomaly

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Will Mortensen <will(at)extrahop(dot)com>, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] Attempt to clarify example of serialization anomaly
Date: 2023-06-21 11:45:44
Message-ID: 2ede679a79a55f62450bcc7bc7893730c3a2e5ed.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Tue, 2023-06-20 at 20:01 -0700, Will Mortensen wrote:
> Rebased on master and updated the wording in several places. All
> feedback is appreciated. :-)
>
> I now see how to link to the wiki from the docs. I guess I numbered
> the transactions differently than the wiki's version though; I can
> rework it to more closely match the wiki if linking seems
> desirable.

I agree that the current wording in the documentation is too terse,
so your patch is an improvement.

There is still the potential for confusion. Perhaps an example with
explicit SQL statements (as in the other sections) might be even better.

Perhaps something simple like

If two concurrent sessions run:

BEGIN ISOLATION LEVEL REPEATABLE READ;
SELECT count(*) FROM tab WHERE name = 'alice';
/* if the result is <> 0, rollback */
INSERT INTO table (name) VALUES ('alice');
COMMIT;

you could end up with two rows with the same name, which could not
happen in a serial execution of the transactions.

Yours,
Laurenz Albe

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message B M 2023-06-21 16:52:47 large scale reliable software system
Previous Message Will Mortensen 2023-06-21 03:01:59 Re: [PATCH] Attempt to clarify example of serialization anomaly