Re: BUG #17949: Adding an index introduces serialisation anomalies. - Mailing list pgsql-bugs

From Peter Geoghegan
Subject Re: BUG #17949: Adding an index introduces serialisation anomalies.
Date
Msg-id CAH2-WzkNoTn3yXY0iGkSuavJ+sL8EROf+kitW+_2v2tJVWuKmA@mail.gmail.com
Whole thread
In response to Re: BUG #17949: Adding an index introduces serialisation anomalies.  (Thomas Munro <thomas.munro@gmail.com>)
List pgsql-bugs
On Tue, Jun 27, 2023 at 11:18 PM Thomas Munro <thomas.munro@gmail.com> wrote:
> I'll push these in a couple of days if there are no further comments.

I spotted an oversight in this fix: scans that use no scan keys (i.e.,
full index scans, or the first primscan used during a skip scan) will
go through _bt_endpoint, which lacks the _bt_first handling that you
added to the end of _bt_first (which will never be reached). You need
a second copy of the empty tree handling in _bt_endpoint.

Attached bug fix shows what I mean.

There's a second patch that adds an isolation test that would have
caught the original problem, as well as this still-overlooked
_bt_endpoint variant. When this fix went in we didn't have injection
points. Now we do, which makes testing these kinds of scenarios
straightforward.

--
Peter Geoghegan

Attachment

pgsql-bugs by date:

Previous
From: Danimar Ribeiro
Date:
Subject: Re: BUG #19424: Concurrent PQconnectdb() calls hang on Windows
Next
From: Richard Guo
Date:
Subject: Re: BUG #19553: Wrong results from nested LEFT JOINs over an empty subquery (regression since v16)