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