From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix incorrect logic in HaveRegisteredOrActiveSnapshot().
Date: Sat, 16 Apr 2022 20:04:55 +0000
Message-ID: <E1nfof9-000pKV-Dy@gemulon.postgresql.org> (raw)
Fix incorrect logic in HaveRegisteredOrActiveSnapshot().
This function gave the wrong answer when there's more than one
RegisteredSnapshots entry, whether or not any of them is the
CatalogSnapshot. This leads to assertion failure in some scenarios
involving fetching toasted data using a cursor. (As per discussion,
I'm dubious that this is the right contract to be enforcing at all;
but it surely doesn't help to be enforcing it incorrectly.)
Fetching toasted data using a cursor is evidently under-tested,
so add a test case too.
Per report from Erik Rijkers. This is new code, so no need for
back-patch.
Discussion: https://postgr.es/m/dc9dd229-ed30-6c62-4c41-d733ffff776b@xs4all.nl
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/9f4f0a0dad4c7422a97d94e4051c08ec6d181dd6
Modified Files
--------------
src/backend/utils/time/snapmgr.c | 6 +++---
src/test/regress/expected/portals.out | 25 +++++++++++++++++++++++++
src/test/regress/sql/portals.sql | 24 ++++++++++++++++++++++++
3 files changed, 52 insertions(+), 3 deletions(-)
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-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Fix incorrect logic in HaveRegisteredOrActiveSnapshot().
In-Reply-To: <E1nfof9-000pKV-Dy@gemulon.postgresql.org>
References: <E1nfof9-000pKV-Dy@gemulon.postgresql.org>
* 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