From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix uninitialized cache use in gtsvector_picksplit()
Date: Wed, 11 Nov 2026 00:31:30 +0000
Message-ID: <E1xQwFO-00000000Exb-2qyU@gemulon.postgresql.org> (raw)
Fix uninitialized cache use in gtsvector_picksplit()
When a page split involves two entries, the seed selection loop does not
run and the seeds default to entries 1 and 2. The cache of the last
entry was filled only after the initial union keys were built from it,
hence the right side of the union could be computed from memory that was
not initialized. This could cause index scans to miss matching rows.
This issue is fixed by filling the cache of the last entry before
forming the initial unions, by moving around a fillcache().
GiST indexes based on tsvector may need a REINDEX, if these are based on
a single column.
Issue spotted originally by valgrind.
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Author: Shihao Zhong <zhong950419@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/19780-93fb5c0e4ec2af18@postgresql.org
Backpatch-through: 15
Branch
------
REL_18_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/19a5f3e405da30a6355f60dd8f1ddc497c4016fe
Modified Files
--------------
src/backend/utils/adt/tsgistidx.c | 6 ++++--
src/test/regress/expected/tsearch.out | 17 +++++++++++++++++
src/test/regress/sql/tsearch.sql | 13 +++++++++++++
3 files changed, 34 insertions(+), 2 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: michael@paquier.xyz
Subject: Re: pgsql: Fix uninitialized cache use in gtsvector_picksplit()
In-Reply-To: <E1xQwFO-00000000Exb-2qyU@gemulon.postgresql.org>
References: <E1xQwFO-00000000Exb-2qyU@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