BUG #17440: not expected result from jsonb_path_query - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #17440: not expected result from jsonb_path_query
Date
Msg-id 17440-b8f554829089cf0f@postgresql.org
Whole thread Raw
Responses Re: BUG #17440: not expected result from jsonb_path_query
List pgsql-bugs
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


pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #17439: DROP FUNCTION functionName(); drops associated generated column without using CASCADE
Next
From: Tom Lane
Date:
Subject: Re: BUG #17439: DROP FUNCTION functionName(); drops associated generated column without using CASCADE