nblxa@mail.ru writes:
> When JSON contains '\\' symbol, then operator '=' works well, but operator
> 'LIKE' return wrong result.
> SELECT '{"Name":"Domen\\Ivan"}'::json ->> 'Name' = 'Domen\Ivan'; -- yields
> true
> SELECT '{"Name":"Domen\\Ivan"}'::json ->> 'Name' LIKE 'Domen\Ivan'; --
> yields false
> SELECT '{"Name":"Domen\\Ivan"}'::json ->> 'Name' LIKE 'Domen\\Ivan'; --
> yields true
I think you've forgotten that backslash is an escape character in LIKE
patterns. You could use ... LIKE 'Domen\Ivan' ESCAPE '' if you don't
want that behavior.
https://www.postgresql.org/docs/current/static/functions-matching.html#FUNCTIONS-LIKE
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs