From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: voronaam@gmail.com
Subject: BUG #18510: jsonpath does not support trailing backslash at the end of the query
Date: Fri, 14 Jun 2024 20:03:55 +0000
Message-ID: <18510-744a9f0c859e3b45@postgresql.org> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, voronaam@gmail.com
Subject: Re: BUG #18510: jsonpath does not support trailing backslash at the end of the query
In-Reply-To: <18510-744a9f0c859e3b45@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox