Bug / Unexpected behaviour of NOT LIKE

Поиск
Список
Период
Сортировка
От Judith Meyer
Тема Bug / Unexpected behaviour of NOT LIKE
Дата
Msg-id CAD9YNfx05sRf2DSd4Z5VvudYuS_Wxk7HD9L5-=Ez8QaAJY3qzA@mail.gmail.com
обсуждение исходный текст
Ответы Re: Bug / Unexpected behaviour of NOT LIKE  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Bug / Unexpected behaviour of NOT LIKE  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-bugs
Hi,

I believe that I have found a bug or at least an undocumented unexpected behaviour in the NOT LIKE operator (tested in PG 13). Namely, the query 

SELECT * FROM users WHERE comment NOT LIKE 'hello%'; 

never returns any users where the comment cell is empty, even though empty also isn't "hello%". This caused bugs in several parts of my code and there is nothing about it in the documentation of the LIKE operator.

If this is intended behaviour, I believe that it deserves a big warning note in the documentation: all occasions where someone might reasonably use NOT LIKE should be combined with a IS NULL OR, i.e. "comment IS NULL OR comment NOT LIKE 'hello%'"

Best wishes,

Judith Meyer
>>DiEM25

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #17216: No Password Provided Error - uncaught exception
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Bug / Unexpected behaviour of NOT LIKE