pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix GIN index search for root strings in strict jsonpath queries 7+ messages / 1 participants [nested] [flat]
* pgsql: Fix GIN index search for root strings in strict jsonpath queries @ 2026-10-24 18:27 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2026-10-24 18:27 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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@gmail.com> Reviewed-by: shihao zhong <zhong950419@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CAHWVJhHH0k3PxWmS==V1p_PONOMUaSm6LjUV487fwnOqd0jTQw@mail.gmail.com Backpatch-through: 14 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/1b0b45c5ab1aa5dc3c71cfa8e228306c2b92875c 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(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix GIN index search for root strings in strict jsonpath queries @ 2026-10-24 18:27 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2026-10-24 18:27 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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@gmail.com> Reviewed-by: shihao zhong <zhong950419@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CAHWVJhHH0k3PxWmS==V1p_PONOMUaSm6LjUV487fwnOqd0jTQw@mail.gmail.com Backpatch-through: 14 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/d44852026b00df941cc790f7f25dfe34b2c13fbd 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(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix GIN index search for root strings in strict jsonpath queries @ 2026-10-24 18:27 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2026-10-24 18:27 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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@gmail.com> Reviewed-by: shihao zhong <zhong950419@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CAHWVJhHH0k3PxWmS==V1p_PONOMUaSm6LjUV487fwnOqd0jTQw@mail.gmail.com Backpatch-through: 14 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/65f3b7096b23ca905e2be4359097a36e5b180580 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(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix GIN index search for root strings in strict jsonpath queries @ 2026-10-24 18:27 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2026-10-24 18:27 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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@gmail.com> Reviewed-by: shihao zhong <zhong950419@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CAHWVJhHH0k3PxWmS==V1p_PONOMUaSm6LjUV487fwnOqd0jTQw@mail.gmail.com Backpatch-through: 14 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/19656b77d16d996e94d01ade59a6132826b8c347 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(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix GIN index search for root strings in strict jsonpath queries @ 2026-10-24 18:27 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2026-10-24 18:27 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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@gmail.com> Reviewed-by: shihao zhong <zhong950419@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CAHWVJhHH0k3PxWmS==V1p_PONOMUaSm6LjUV487fwnOqd0jTQw@mail.gmail.com Backpatch-through: 14 Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/0cf2c7e38fa1ed81224e028014fef9ee666abcc4 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(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix GIN index search for root strings in strict jsonpath queries @ 2026-10-24 18:27 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2026-10-24 18:27 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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@gmail.com> Reviewed-by: shihao zhong <zhong950419@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CAHWVJhHH0k3PxWmS==V1p_PONOMUaSm6LjUV487fwnOqd0jTQw@mail.gmail.com Backpatch-through: 14 Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/3b2a60481c84b1e8acca48878659c6ca619186d8 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(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix GIN index search for root strings in strict jsonpath queries @ 2026-10-24 18:27 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2026-10-24 18:27 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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@gmail.com> Reviewed-by: shihao zhong <zhong950419@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.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(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2026-10-24 18:27 UTC | newest] Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-10-24 18:27 pgsql: Fix GIN index search for root strings in strict jsonpath queries Tom Lane <tgl@sss.pgh.pa.us> 2026-10-24 18:27 pgsql: Fix GIN index search for root strings in strict jsonpath queries Tom Lane <tgl@sss.pgh.pa.us> 2026-10-24 18:27 pgsql: Fix GIN index search for root strings in strict jsonpath queries Tom Lane <tgl@sss.pgh.pa.us> 2026-10-24 18:27 pgsql: Fix GIN index search for root strings in strict jsonpath queries Tom Lane <tgl@sss.pgh.pa.us> 2026-10-24 18:27 pgsql: Fix GIN index search for root strings in strict jsonpath queries Tom Lane <tgl@sss.pgh.pa.us> 2026-10-24 18:27 pgsql: Fix GIN index search for root strings in strict jsonpath queries Tom Lane <tgl@sss.pgh.pa.us> 2026-10-24 18:27 pgsql: Fix GIN index search for root strings in strict jsonpath queries Tom Lane <tgl@sss.pgh.pa.us>
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