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

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: BUG #18510: jsonpath does not support trailing backslash at the end of the query
Дата
Msg-id CAKFQuwa+MmScFnf=hNyUih2O0LkKgDw2uy39Ff0870zgP3v72Q@mail.gmail.com
обсуждение исходный текст
Ответ на BUG #18510: jsonpath does not support trailing backslash at the end of the query  (PG Bug reporting form <noreply@postgresql.org>)
Ответы Re: BUG #18510: jsonpath does not support trailing backslash at the end of the query  (Lex Vorona <voronaam@gmail.com>)
Re: BUG #18510: jsonpath does not support trailing backslash at the end of the query  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Список pgsql-bugs
On Fri, Jun 14, 2024 at 1:24 PM PG Bug reporting form <noreply@postgresql.org> wrote:
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:       

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;


It is working just fine.  It sees both the regex and the backslash character and then helpfully tells you that the regex you wrote is bogus since the backslash you wrote isn't escaping anything.

If you need a literal backslash in a jsonpath string literal you need to write four of them.  Each pair leaves one \ in the regex and then \\ in a regex is just a literally matched character.

David J.

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

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #18510: jsonpath does not support trailing backslash at the end of the query
Следующее
От: Rafael Thofehrn Castro
Дата:
Сообщение: Inconsistent increment of pg_stat_database.xact_rollback with logical replication