pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Poot, Bas (B.J.) <bas.poot@politie.nl>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: subselect removes rows
Date: Mon, 29 Nov 2021 10:01:35 -0500
Message-ID: <1217100.1638198095@sss.pgh.pa.us> (raw)
In-Reply-To: <a5ed0b646f2e465d90954fa79d5837b5@politie.nl>
References: <a5ed0b646f2e465d90954fa79d5837b5@politie.nl>

"Poot, Bas (B.J.)" <bas.poot@politie.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





view thread (7+ messages)  latest in thread

Message-ID: <1217100.1638198095@sss.pgh.pa.us>
Permalink:  ../1217100.1638198095@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1217100.1638198095@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, bas.poot@politie.nl
  Subject: Re: subselect removes rows
  In-Reply-To: <1217100.1638198095@sss.pgh.pa.us>
  References: <a5ed0b646f2e465d90954fa79d5837b5@politie.nl> <1217100.1638198095@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox