BUG #17660: JSONPATH issue using like_regex followed by the && operator

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: shahar(at)cybear(dot)co
Subject: BUG #17660: JSONPATH issue using like_regex followed by the && operator
Date: 2022-10-22 11:55:24
Message-ID: 17660-3fe48447b080d5b6@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 17660
Logged by: Shahar Belizon
Email address: shahar(at)cybear(dot)co
PostgreSQL version: 14.4
Operating system: CentOS
Description:

Hello,
I've found an issue with the like_regex statement when using it together
with another && condition.
In the following example I'm expecting the result will end as:
[{"id":9,"value":"a"}] but instead, it ends with an empty array:

WITH a(attributes) AS (
SELECT '[{"id":9,"value":"a"},{"id":9,"value":"a$"}]'::jsonb
)
SELECT jsonb_path_query_array(attributes,'$[*] ? (!(@.id==9 && @.value
like_regex "\$$"))') FROM a

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2022-10-22 13:48:46 Re: BUG #17660: JSONPATH issue using like_regex followed by the && operator
Previous Message Pantelis Theodosiou 2022-10-21 23:22:51 Re: Delete from table where id in (bugged query) - fully remove all data without any notice.