BUG #18510: jsonpath does not support trailing backslash at the end of the query

Поиск
Список
Период
Сортировка
От PG Bug reporting form
Тема BUG #18510: jsonpath does not support trailing backslash at the end of the query
Дата
Msg-id 18510-744a9f0c859e3b45@postgresql.org
обсуждение исходный текст
Ответы Re: BUG #18510: jsonpath does not support trailing backslash at the end of the query  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      18510
Logged by:          Lex Vorona
Email address:      voronaam@gmail.com
PostgreSQL version: 16.3
Operating system:   Linux (Ubuntu)
Description:

Note that JSONPATH documentation states [1]:

>  to write a backslash itself, you must write \\

It works for a backslash as long as it is not the last character in the
input string.

Simplest way to reproduce:

psql (16.3 (Ubuntu 16.3-1.pgdg22.04+1))

postgres=# select '$.field ? (@ like_regex "a\\b")'::jsonpath; -- works
            jsonpath             
---------------------------------
 $."field"?(@ like_regex "a\\b")
(1 row)


postgres=# select '$.field ? (@ like_regex "a\\")'::jsonpath; -- does not
work
ERROR:  invalid regular expression: invalid escape \ sequence
LINE 1: select '$.field ? (@ like_regex "a\\")'::jsonpath;
               ^

Also reproducible with functions like jsonb_path_exists(...) which
automatically cast parameters to jsonpath.


1:
https://www.postgresql.org/docs/current/datatype-json.html#DATATYPE-JSONPATH


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

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #18509: Logical decoding behaves badly when processing a change record for a table with altered column
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: BUG #18510: jsonpath does not support trailing backslash at the end of the query