On Mon, Apr 16, 2018 at 11:51 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> You're on to something, but I think the bug is in
> spg_text_leaf_consistent, which thinks it can do collation-aware
> comparisons like this:
>
> r = varstr_cmp(fullValue, Min(queryLen, fullLen),
> VARDATA_ANY(query), Min(queryLen, fullLen),
> PG_GET_COLLATION());
Ah. Those arguments make that code completely broken.
> and then the bit below about
>
> if (r == 0)
> {
> if (queryLen > fullLen)
> r = -1;
> else if (queryLen < fullLen)
> r = 1;
> }
>
> needs to move into the "non-collation-aware" branch.
Right. Alternatively, you could actually call varstr_cmp() within the
"non-collation-aware" branch.
--
Peter Geoghegan