From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | exe-dealer <exe-dealer(at)yandex(dot)ru> |
Cc: | "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: jsonb subscript operator returns null when key is fetched from table |
Date: | 2022-12-12 18:51:19 |
Message-ID: | CAKFQuwaKHLG5cPPmeoE0uYu5MYrHkwxhH1LV9aE0QrcDk0GnpA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Fri, Dec 9, 2022 at 1:35 PM exe-dealer <exe-dealer(at)yandex(dot)ru> wrote:
> jsonb subscript operator returns null when key is fetched from table.
>
> PostgreSQL 15.1 on x86_64-pc-linux-musl, compiled by gcc (Alpine
> 12.2.1_git20220924-r4) 12.2.1 20220924, 64-bit
>
> WITH cte AS MATERIALIZED (SELECT 'foo' k, '{"foo":"bar"}'::jsonb j)
> SELECT j[k], j[k || ''] FROM cte;
>
> -- returns
> -- null, "bar"
>
> -- expected
> -- "bar", "bar"
>
Thanks for the report. I can confirm that this is a problem in both v14
and v15.
To clarify the subject line - the issue manifests only if the CTE is
MATERIALIZED.
Someone more experienced than I will need to actually do the debugging work
though; hoping this reply will be seen by one of them.
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2022-12-12 19:09:21 | Re: jsonb subscript operator returns null when key is fetched from table |
Previous Message | Jean-Francois Levesque | 2022-12-12 18:36:18 | Re: BUG #17710: Slow queries (100% CPU) after auto-vacuum |