Re: Wrong results with equality search using trigram index and non-deterministic collation - Mailing list pgsql-hackers

From Zsolt Parragi
Subject Re: Wrong results with equality search using trigram index and non-deterministic collation
Date
Msg-id CAN4CZFNTeOU-omwNvgVrgGZhe1MTFXQXOv-28S4-GEjO5ytV7w@mail.gmail.com
Whole thread
In response to Re: Wrong results with equality search using trigram index and non-deterministic collation  (Laurenz Albe <laurenz.albe@cybertec.at>)
List pgsql-hackers
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?



pgsql-hackers by date:

Previous
From: Dmitry Dolgov
Date:
Subject: Re: Randomize B-Tree page split location to avoid oscillating patterns
Next
From: Alexandra Wang
Date:
Subject: Re: Remove inner joins based on foreign keys