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

From: Lex Vorona <voronaam(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18510: jsonpath does not support trailing backslash at the end of the query
Date: 2024-06-14 22:16:21
Message-ID: CAL_Jc-GS93kStpeJhuuWrpWZx=v85SDorVvNH+OO9vMfS9bFmQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Thank you. The bug can be closed then and I will make sure I have enough
slashes coming through. The query originates in a Java string, meaning it
will be eight trailing slashes to match.

Thanks again for a quick response.

-- Lex

On Fri, Jun 14, 2024 at 1:32 PM David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)com> wrote:

> On Fri, Jun 14, 2024 at 1:24 PM PG Bug reporting form <
> noreply(at)postgresql(dot)org> wrote:
>
>> The following bug has been logged on the website:
>>
>> Bug reference: 18510
>> Logged by: Lex Vorona
>> Email address: voronaam(at)gmail(dot)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.
>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Robert Treat 2024-06-15 11:58:01 Re: BUG #18508: Not all packages are present in the repo on rhel 8
Previous Message Rafael Thofehrn Castro 2024-06-14 22:15:06 Inconsistent increment of pg_stat_database.xact_rollback with logical replication