Re: BUG #5737: LIKE and ILIKE strange behaviour

Поиск
Список
Период
Сортировка
От John R Pierce
Тема Re: BUG #5737: LIKE and ILIKE strange behaviour
Дата
Msg-id 4CCE3B72.2090800@hogranch.com
обсуждение исходный текст
Ответ на BUG #5737: LIKE and ILIKE strange behaviour  ("Radu Ilies" <ilies.radu@gmail.com>)
Список pgsql-bugs
On 10/31/10 12:28 PM, Radu Ilies wrote:
> id, char[25]
> name, text
>
> The first row is:
>
> id='radu'
> name='Radu Ilies'
>
> The following queries does not find any result (fail):
> SELECT * FROM my_table WHERE id LIKE 'radu'
> SELECT * FROM my_table WHERE id ILIKE 'radu'
>

'radu'::char[25] ==>  'radu_____________________'     (21 spaces).

the = equality coerces the 'radu'::text to 'radu
'::char[25] before doing the comparision.
LIKE/ILIKE doesn't think 'radu_____________________' is LIKE 'radu'

use TEXT for character types unless you have a very specific requirement
to limit them to a maximum length.

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

Предыдущее
От: "Radu Ilies"
Дата:
Сообщение: BUG #5737: LIKE and ILIKE strange behaviour
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: ecpg preprocessor regression in 9.0