| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Fix GIN index search for root strings in strict jsonpath queries |
| Date: | 2026-10-24 18:27:29 |
| Message-ID: | E1xKgSn-00000000bYE-2H2K@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Fix GIN index search for root strings in strict jsonpath queries.
A jsonb_ops index scan for 'strict $ == "a scalar"' missed a matching
root string. Root scalars are stored in single-element arrays, so
gin_extract_jsonb() indexes strings with JGINFLAG_KEY. In strict mode,
jsonb_ops__extract_nodes() instead searches for JGINFLAG_STR at the
root. Leave gin_extract_jsonb() alone (else we'd force people to
reindex) and make jsonb_ops__extract_nodes() search for JGINFLAG_KEY
instead.
Author: Rui Zhao <zhaorui126(at)gmail(dot)com>
Reviewed-by: shihao zhong <zhong950419(at)gmail(dot)com>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/CAHWVJhHH0k3PxWmS==V1p_PONOMUaSm6LjUV487fwnOqd0jTQw@mail.gmail.com
Backpatch-through: 14
Branch
------
REL_14_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/327c5f0e6c1be3494344386c0d5848c5f4ab9252
Modified Files
--------------
src/backend/utils/adt/jsonb_gin.c | 5 +++--
src/test/regress/expected/jsonb.out | 27 +++++++++++++++++++++++++++
src/test/regress/sql/jsonb.sql | 8 ++++++++
3 files changed, 38 insertions(+), 2 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Daniel Gustafsson | 2026-10-24 20:38:21 | pgsql: doc: Remove mention of FreeBSD using DocBook |
| Previous Message | Bruce Momjian | 2026-10-23 19:05:11 | pgsql: doc PG 18 relnotes: add incompatibility item about SQLSTATE |