agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Avoid collation lookup failure when considering a "char" column.
Date: Sun, 28 Jun 2026 16:31:36 +0000
Message-ID: <E1wdsPw-000Xld-1d@gemulon.postgresql.org> (raw)

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(+)



view thread (2+ messages)

Message-ID: <E1wdsPw-000Xld-1d@gemulon.postgresql.org>
Permalink:  ../E1wdsPw-000Xld-1d@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wdsPw-000Xld-1d@gemulon.postgresql.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Avoid collation lookup failure when considering a "char" column.
  In-Reply-To: <E1wdsPw-000Xld-1d@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox