pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fujii Masao <fujii@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix possible index corruption in pg_trgm GiST indexes
Date: Wed, 04 Nov 2026 02:21:22 +0000
Message-ID: <E1xOQcs-0000000066f-3oeo@gemulon.postgresql.org> (raw)

Fix possible index corruption in pg_trgm GiST indexes

Commit 911e7020770, which added configurable signature lengths,
introduced an error in how gist_trgm_ops index entries are combined.
Some entries could lose the flag identifying their format, causing
later inserts to treat them as empty and lose information about
existing entries.  As a result, queries using these indexes could
miss matching rows.

Fix this by preserving the format flag when combining index entries,
so that subsequent inserts correctly retain the information they
represent.

This fix does not repair existing indexes.  Users should REINDEX all
existing gist_trgm_ops indexes after upgrading to a release containing
this fix.

Backpatch to all supported versions.

Author: Nate Clark <natec425@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/19720-b3e83f5e99c485c5@postgresql.org
Backpatch-through: 14

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/60ccd730da518037484ce96cf270b811a463b3b7

Modified Files
--------------
contrib/pg_trgm/trgm_gist.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



view thread (7+ messages)  latest in thread

Message-ID: <E1xOQcs-0000000066f-3oeo@gemulon.postgresql.org>
Permalink:  ../E1xOQcs-0000000066f-3oeo@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xOQcs-0000000066f-3oeo@gemulon.postgresql.org

 · 

reply

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: fujii@postgresql.org
  Subject: Re: pgsql: Fix possible index corruption in pg_trgm GiST indexes
  In-Reply-To: <E1xOQcs-0000000066f-3oeo@gemulon.postgresql.org>
  References: <E1xOQcs-0000000066f-3oeo@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