BUG #17660: JSONPATH issue using like_regex followed by the && operator - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #17660: JSONPATH issue using like_regex followed by the && operator
Date
Msg-id 17660-3fe48447b080d5b6@postgresql.org
Whole thread Raw
Responses Re: BUG #17660: JSONPATH issue using like_regex followed by the && operator
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      17660
Logged by:          Shahar Belizon
Email address:      shahar@cybear.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


pgsql-bugs by date:

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