Re: [PATCH] Avoid collation lookup for "char" statistics
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Feng Wu <wufengwufengwufeng@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2026-06-28T16:41:21Z
Lists: pgsql-hackers
I wrote: > Even where there is a histogram, it'd be unlikely for someone to > issue a query that would hit this code, so the lack of prior > reports isn't as surprising as I thought. I had supposed that this was an old bug, but on attempting to back-patch I found it wasn't broken before v18. So that's another big reason for lack of prior reports. Commit 06421b084 replaced a call to lc_collate_is_c(), which tolerated InvalidOid, with pg_newlocale_from_collation() which doesn't. Seeing this, I thought we'd be best off to put the test where you had it but make it test for !OidIsValid(collid) rather than hard-wiring typid == CHAROID. There probably aren't other cases where we reach here with collid 0, but if there are, we want the code to not fail, as it did not before. Pushed with a test based on an inequality comparison (in HEAD only, because there didn't seem to be a suitable test file in 18). regards, tom lane
Commits
-
Avoid collation lookup failure when considering a "char" column.
- b574fec00f27 19 (unreleased) landed
- 5fd1c3f28718 18 (unreleased) landed
-
Remove lc_collate_is_c().
- 06421b084364 18.0 cited