Re: Wrong Results from SP-GiST with Collations

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Wrong Results from SP-GiST with Collations
Дата
Msg-id 19693.1523904666@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Wrong Results from SP-GiST with Collations  (Peter Geoghegan <pg@bowt.ie>)
Ответы Re: Wrong Results from SP-GiST with Collations  (Peter Geoghegan <pg@bowt.ie>)
Список pgsql-bugs
Peter Geoghegan <pg@bowt.ie> writes:
> Has the operator class really been completely broken since SP-GiST was
> first introduced? I tend to doubt that. spg_text_inner_consistent()
> has the following code, which appears to acknowledge the problem with
> non-C collations:

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

That's got nothing to do with reality for non-C collations, and it seems
rather pointless anyway,  Why isn't this just

            r = varstr_cmp(fullValue, fullLen,
                           VARDATA_ANY(query), queryLen,
                           PG_GET_COLLATION());

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.

            regards, tom lane


В списке pgsql-bugs по дате отправления:

Предыдущее
От: Peter Geoghegan
Дата:
Сообщение: Re: BUG #15144: *** glibc detected *** postgres: postgres smsconsole[local] SELECT: double free or corruption (!pre
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: Wrong Results from SP-GiST with Collations