Re: [HACKERS] another locale problem

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] another locale problem
Дата
Msg-id 13629.929137273@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] another locale problem  (Daniel Kalchev <daniel@digsys.bg>)
Ответы Re: [HACKERS] another locale problem  (Daniel Kalchev <daniel@digsys.bg>)
Список pgsql-hackers
Daniel Kalchev <daniel@digsys.bg> writes:
> In fact, after giving it some though... the expression in gram.y

>                         (strcmp(opname,"~*")
> == 0 && isalpha(n->val.val.str[pos])))

> is wrong. The statement in my view decides that a regular expression is not 
> indexable if it contains special characters or if it contains non-alpha 
> characters. Therefore, the statement should be written as:

>                         (strcmp(opname,"~*")
> == 0 && !isalpha((unsigned char)n->val.val.str[pos])))

No, it's not wrong, at least not in that way!  You've missed the point
entirely.  ~* is the *case insensitive* regexp match operator.
Therefore if I have a pattern like '^abc' it can match anything
beginning with either 'a' or 'A'.  If the index restriction were to
include the letter 'a' then it would exclude valid matches starting with
'A'.  The simplest solution, which is what's in makeIndexable(), is
to exclude case-foldable characters from the index restriction pattern.
In this particular case you end up getting no index restriction at all,
but that is indeed what's supposed to happen.

I am not sure that isalpha() is an adequate test for case-foldable
characters in non-ASCII locales, but inverting it is definitely wrong ;-)
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Re: locales and MB (was: Postgres 6.5 beta2 and beta3 problem)
Следующее
От: Oleg Bartunov
Дата:
Сообщение: BUG: ERROR: regcomp failed with error empty (sub)expression