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: edouard.hibon@free.fr
Subject: BUG #17440: not expected result from jsonb_path_query
Date: Tue, 15 Mar 2022 16:58:59 +0000
Message-ID: <17440-b8f554829089cf0f@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      17440
Logged by:          Edouard HIBON
Email address:      edouard.hibon@free.fr
PostgreSQL version: 14.0
Operating system:   windows 10
Description:        

Query 1 : SELECT jsonb_path_query('[1,2,3]' :: jsonb, '$') results in 1
value '[1,2,3]' :: jsonb as expected
Query 2 : SELECT jsonb_path_query('[1,2,3]' :: jsonb, '$[*]') results in a
set of 3 values '1', '2', '3' as expected
Query 3 : SELECT jsonb_path_query('[1,2,3]' :: jsonb, '$[*] ? (@ <> null)')
results in a set of 3 values '1', '2', '3' as expected
Query 4 : SELECT jsonb_path_query('[1,2,3]' :: jsonb, '$ ? (@ <> null)')
results in a set of 3 values '1', '2', '3' as for the queries 2 & 3 whereas
I would expect only one value '[1,2,3]' as for the query 1 because there is
no member accessor nor array element accessor in this jsonpath, and @ should
represent the initial jsonb value being queried $

demo :
https://dbfiddle.uk/?rdbms=postgres_14&fiddle=f09164502df5ee1bb620057689e6f810



view thread (2+ messages)  latest in thread

Message-ID: <17440-b8f554829089cf0f@postgresql.org>
Permalink:  ../17440-b8f554829089cf0f@postgresql.org/
Also on:    postgresql.org/message-id/17440-b8f554829089cf0f@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, edouard.hibon@free.fr
  Subject: Re: BUG #17440: not expected result from jsonb_path_query
  In-Reply-To: <17440-b8f554829089cf0f@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