pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: shahar@cybear.co
Subject: BUG #17660: JSONPATH issue using like_regex followed by the && operator
Date: Sat, 22 Oct 2022 11:55:24 +0000
Message-ID: <17660-3fe48447b080d5b6@postgresql.org> (raw)

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



view thread (4+ messages)  latest in thread

Message-ID: <17660-3fe48447b080d5b6@postgresql.org>
Permalink:  ../17660-3fe48447b080d5b6@postgresql.org/
Also on:    postgresql.org/message-id/17660-3fe48447b080d5b6@postgresql.org

 · 

reply

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, shahar@cybear.co
  Subject: Re: BUG #17660: JSONPATH issue using like_regex followed by the && operator
  In-Reply-To: <17660-3fe48447b080d5b6@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