Re: sql/json miscellaneous issue - Mailing list pgsql-hackers

From Amit Langote
Subject Re: sql/json miscellaneous issue
Date
Msg-id CA+HiwqF3Zq3iJoXCyS3uwb8ydELYuyT1WHOw=2TepYKnBp5NBg@mail.gmail.com
Whole thread Raw
In response to sql/json miscellaneous issue  (jian he <jian.universality@gmail.com>)
Responses Re: sql/json miscellaneous issue
List pgsql-hackers
Hi,

On Mon, Jun 24, 2024 at 7:04 PM jian he <jian.universality@gmail.com> wrote:
>
> hi.
> the following two queries should return the same result?
>
> SELECT * FROM JSON_query (jsonb 'null', '$' returning jsonb);
> SELECT * FROM JSON_value (jsonb 'null', '$' returning jsonb);

I get this with HEAD:

SELECT * FROM JSON_query (jsonb 'null', '$' returning jsonb);
 json_query
------------
 null
(1 row)

Time: 734.587 ms
SELECT * FROM JSON_value (jsonb 'null', '$' returning jsonb);
 json_value
------------

(1 row)

Much like:

SELECT JSON_QUERY('{"key": null}', '$.key');
 json_query
------------
 null
(1 row)

Time: 2.975 ms
SELECT JSON_VALUE('{"key": null}', '$.key');
 json_value
------------

(1 row)

Which makes sense to me, because JSON_QUERY() is supposed to return a
JSON null in both cases and JSON_VALUE() is supposed to return a SQL
NULL for a JSON null.

--
Thanks, Amit Langote



pgsql-hackers by date:

Previous
From: shveta malik
Date:
Subject: Re: Conflict detection and logging in logical replication
Next
From: Amit Kapila
Date:
Subject: Re: speed up a logical replica setup