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

From Amit Langote
Subject Re: sql/json miscellaneous issue
Date
Msg-id CA+HiwqGbLrR3318s+gk2dkwhz3AnTLPgWvWVFqPjpgGYyZq57w@mail.gmail.com
Whole thread Raw
In response to Re: sql/json miscellaneous issue  (Stepan Neretin <sncfmgg@gmail.com>)
List pgsql-hackers
Hi,

On Mon, Jun 24, 2024 at 8:02 PM Stepan Neretin <sncfmgg@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
stringby 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



pgsql-hackers by date:

Previous
From: Stepan Neretin
Date:
Subject: Re: sql/json miscellaneous issue
Next
From: Ranier Vilela
Date:
Subject: Re: Avoid incomplete copy string (src/backend/access/transam/xlog.c)