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
Re: Bug / Unexpected behaviour of NOT LIKE |
Список | 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 по дате отправления: