citext function overloads for text parameters

Поиск
Список
Период
Сортировка
От Shay Rojansky
Тема citext function overloads for text parameters
Дата
Msg-id CADT4RqBWiK_aoAi6C8dNuevnXAnGhyzkJCvW2XunWDo-AZrb3g@mail.gmail.com
обсуждение исходный текст
Ответы Re: citext function overloads for text parameters  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
Hi hackers.

The following works well of course:

test=# select strpos('Aa'::citext, 'a');
 strpos 
--------
      1

However, if I pass a typed text parameter for the substring, I get case-sensitive behavior instead:

test=# select strpos('Aa'::citext, 'a'::text);
 strpos 
--------
      2

This seems like surprising behavior - my expectation was that the first parameter being citext would be enough to trigger case-insensitive behavior. The same may be happening with other string functions (e.g. regexp_matches). This is causing some difficulties in a real scenario where SQL and parameters are getting generated by an O/RM, and changing them isn't trivial.

Do the above seem like problematic behavior like it does to me, or is it the expected behavior?

Shay

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: genbki.pl not quoting keywords in postgres.bki output
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: citext function overloads for text parameters