pgsql: Tighten up TS dictionary cache entry creation.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Tighten up TS dictionary cache entry creation.
Date: 2026-08-02 20:49:34
Message-ID: E1wqd7m-00000001OmM-0OB1@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Tighten up TS dictionary cache entry creation.

In the not-too-likely scenario where we successfully created a hash
table entry for a TS dictionary, but then failed to make a small
memory context for it, we left the hash entry in existence but with
a garbage value for dictCtx. This confused the code the next time
through, leading to a crash. Rearrange things so that we leave
the hash entry in a well-defined state with dictCtx == NULL, and
then the next try knows it still needs to make a memory context.

Reported-by: Alexander Lakhin <exclusion(at)gmail(dot)com>
Author: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/0f3ddeb5-0dbd-479c-9d0e-ae254758e624@gmail.com
Backpatch-through: 14

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/83336e3ed30b0d0b021900429e5bfde8367e2729

Modified Files
--------------
src/backend/utils/cache/ts_cache.c | 29 +++++++++++++++++++++--------
1 file changed, 21 insertions(+), 8 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Richard Guo 2026-08-03 06:53:58 pgsql: Fix nullability check for a sub-select's upper-level Vars
Previous Message Tom Lane 2026-08-02 17:22:55 pgsql: Fix memory-safety bugs in the ispell/hunspell dictionary loader.