Hi,

On Mon, Jun 24, 2024 at 8:02 PM Stepan Neretin <sncf...@gmail.com> wrote:
> Hi!
>
> I also noticed a very strange difference in behavior in these two queries, it 
> seems to me that although it returns a string by default, for the boolean 
> operator it is necessary to return true or false
> SELECT * FROM JSON_value (jsonb '1', '$ == "1"' returning jsonb);
>  json_value
> ------------
>
> (1 row)
>
>  SELECT * FROM JSON_value (jsonb 'null', '$ == "1"' returning jsonb);
>  json_value
> ------------
>  false
> (1 row)

Hmm, that looks sane to me when comparing the above two queries with
their jsonb_path_query() equivalents:

select jsonb_path_query(jsonb '1', '$ == "1"');
 jsonb_path_query
------------------
 null
(1 row)

select jsonb_path_query(jsonb 'null', '$ == "1"');
 jsonb_path_query
------------------
 false
(1 row)

-- 
Thanks, Amit Langote


Reply via email to