Re: subselect removes rows

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Poot, Bas (B(dot)J(dot))" <bas(dot)poot(at)politie(dot)nl>
Cc: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: subselect removes rows
Date: 2021-11-29 15:01:35
Message-ID: 1217100.1638198095@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Poot, Bas (B.J.)" <bas(dot)poot(at)politie(dot)nl> writes:
> The bug is as follows:
> When using certain commands in a sub-select, it removes the row.
> This should never happen. It should return null instead. It worked in postgres 10, but somehow doesn't work anymore on postgres 13 (which we currently have)

> Example query:

> select
> col1, col2, jsonb_each_text(col2)
> from (
> select 1 as col1, null::jsonb as col2
> union all
> select 1 as col1, '{"a":"2"}'::jsonb as col2
> ) t1

Your claim is quite unclear ... but AFAICS, that query produces exactly
the same results in v10 as in later versions.

regression=# select
col1, col2, jsonb_each_text(col2)
from (
select 1 as col1, null::jsonb as col2
union all
select 1 as col1, '{"a":"2"}'::jsonb as col2
) t1
;
col1 | col2 | jsonb_each_text
------+------------+-----------------
1 | {"a": "2"} | (a,2)
(1 row)

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Poot, Bas (B.J.) 2021-11-29 15:44:54 Re: subselect removes rows
Previous Message Tom Lane 2021-11-29 14:53:15 Re: BUG #17303: statement_timeout does not work always