Thread
-
Re: Wrong results with equality search using trigram index and non-deterministic collation
Zsolt Parragi <zsolt.parragi@percona.com> — 2026-05-07T19:00:04Z
Hello > Does that mean that you could end up with wrong results (which would not > be acceptable), or that you could end up with false positives that > later get eliminated by the recheck (which would be fine)? + /* + * For non-C collations, extract the three bytes from each trigram + * and compare them using the collation's comparison function. + */ ... + /* Use collation-aware comparison */ + result = pg_strncoll(str_a, 3, str_b, 3, locale); + PG_RETURN_INT32(result); For non-C collations, isn't the trigram likely a hash rather than a proper string, where pg_strncoll won't work properly?