From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix use of wrong variable in _hash_kill_items()
Date: Tue, 17 Mar 2026 18:55:05 +0000
Message-ID: <E1w2ZZI-000CpO-3D@gemulon.postgresql.org> (raw)
Fix use of wrong variable in _hash_kill_items()
In 82467f627bd I somehow ended up using 'so->currPos.buf' instead of the 'buf'
variable, which is incorrect when the buffer is not already pinned. At the
very least this can lead to assertion failures
Unfortunately this shows that this code path was not covered. Expand
src/test/modules/index/specs/killtuples.spec to test it. Until now the
'result' step always reported either a 0 or 1 buffer accesses, but when
exercising hash overflows, more buffers are accessed. To avoid depending on
the precise number of accesses, change the result step to return whether there
were any heap accesses. That makes the change a lot more verbose, but still
seems worth it.
Reported-by: Alexander Kuzmenkov <akuzmenkov@tigerdata.com>
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Reported-by: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://postgr.es/m/vjtmvwvbxt7w5uyacxpzibpj65ewcb7uqaqbhd4arvnjbp5jqz%405ksdh6fsyqve
Discussion: https://postgr.es/m/b9de8d05-3b02-4a27-9b0b-03972fa4bfd3@iki.fi
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/f5eb854ab6d6281ec2d3143657944bdda6676341
Modified Files
--------------
src/backend/access/hash/hashutil.c | 4 +-
src/test/modules/index/expected/killtuples.out | 219 +++++++++++++++++--------
src/test/modules/index/specs/killtuples.spec | 15 +-
3 files changed, 163 insertions(+), 75 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 using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: andres@anarazel.de, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Fix use of wrong variable in _hash_kill_items()
In-Reply-To: <E1w2ZZI-000CpO-3D@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