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 <[email protected]> Reviewed-by: Tom Lane <[email protected]> Discussion: https://postgr.es/m/cack3muq6s-o1wc3w4drl1fe8yq-fz1zjbezeqwhulgnxgne...@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(+)
