agora inbox for pgsql-committers@postgresql.orghelp / color / mirror / Atom feed
pgsql: Avoid collation lookup failure when considering a "char" column. 2+ messages / 1 participants [nested] [flat]
* pgsql: Avoid collation lookup failure when considering a "char" column. @ 2026-06-28 16:31 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2026-06-28 16:31 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Avoid collation lookup failure when considering a "char" column. If a "char" column has a statistics histogram, scalarineqsel() would fail with "cache lookup failed for collation 0". Avoid the failing lookup by acting as though the collation is "C". Prior to commit 06421b084, this code didn't fail because lc_collate_is_c() intentionally didn't spit up on InvalidOid. It did act differently though: it would take the non-C-collation code path and hence apply strxfrm using libc's prevailing locale. But that seems like the wrong thing for a non-collatable comparison, so let's not resurrect that aspect. Author: Feng Wu <wufengwufengwufeng@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CACK3muq6s-O1Wc3w4dRL1Fe8YQ-Fz1zJbezeQwhuLgNxGNEFiA@mail.gmail.com Backpatch-through: 18 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/b574fec00f275e50ffe2c9780ec1f6398796c905 Modified Files -------------- src/backend/utils/adt/selfuncs.c | 8 ++++++++ src/test/regress/expected/planner_est.out | 11 +++++++++++ src/test/regress/sql/planner_est.sql | 6 ++++++ 3 files changed, 25 insertions(+) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Avoid collation lookup failure when considering a "char" column. @ 2026-06-28 16:31 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2026-06-28 16:31 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Avoid collation lookup failure when considering a "char" column. If a "char" column has a statistics histogram, scalarineqsel() would fail with "cache lookup failed for collation 0". Avoid the failing lookup by acting as though the collation is "C". Prior to commit 06421b084, this code didn't fail because lc_collate_is_c() intentionally didn't spit up on InvalidOid. It did act differently though: it would take the non-C-collation code path and hence apply strxfrm using libc's prevailing locale. But that seems like the wrong thing for a non-collatable comparison, so let's not resurrect that aspect. Author: Feng Wu <wufengwufengwufeng@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CACK3muq6s-O1Wc3w4dRL1Fe8YQ-Fz1zJbezeQwhuLgNxGNEFiA@mail.gmail.com Backpatch-through: 18 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/5fd1c3f287189cfa4bff4ac3492c313417dff7c9 Modified Files -------------- src/backend/utils/adt/selfuncs.c | 8 ++++++++ 1 file changed, 8 insertions(+) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2026-06-28 16:31 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-06-28 16:31 pgsql: Avoid collation lookup failure when considering a "char" column. Tom Lane <tgl@sss.pgh.pa.us> 2026-06-28 16:31 pgsql: Avoid collation lookup failure when considering a "char" column. Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox