From: | Amit Langote <amitlangote09(at)gmail(dot)com> |
---|---|
To: | Stepan Neretin <sncfmgg(at)gmail(dot)com> |
Cc: | jian he <jian(dot)universality(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: sql/json miscellaneous issue |
Date: | 2024-06-24 11:25:04 |
Message-ID: | CA+HiwqGbLrR3318s+gk2dkwhz3AnTLPgWvWVFqPjpgGYyZq57w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
On Mon, Jun 24, 2024 at 8:02 PM Stepan Neretin <sncfmgg(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Ranier Vilela | 2024-06-24 11:25:36 | Re: Avoid incomplete copy string (src/backend/access/transam/xlog.c) |
Previous Message | Stepan Neretin | 2024-06-24 11:02:46 | Re: sql/json miscellaneous issue |