Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mriA0-0005jR-Hk for pgsql-bugs@arkaria.postgresql.org; Mon, 29 Nov 2021 15:01:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mri9z-0007Eu-Aq for pgsql-bugs@arkaria.postgresql.org; Mon, 29 Nov 2021 15:01:39 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mri9z-0007El-2c for pgsql-bugs@lists.postgresql.org; Mon, 29 Nov 2021 15:01:39 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mri9w-0004ii-K8 for pgsql-bugs@lists.postgresql.org; Mon, 29 Nov 2021 15:01:38 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 1ATF1Zlm1217101; Mon, 29 Nov 2021 10:01:35 -0500 From: Tom Lane To: "Poot, Bas (B.J.)" cc: "pgsql-bugs@lists.postgresql.org" Subject: Re: subselect removes rows In-reply-to: References: Comments: In-reply-to "Poot, Bas (B.J.)" message dated "Mon, 29 Nov 2021 14:08:36 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1217099.1638198095.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 29 Nov 2021 10:01:35 -0500 Message-ID: <1217100.1638198095@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "Poot, Bas (B.J.)" 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 po= stgres 10, but somehow doesn't work anymore on postgres 13 (which we curre= ntly 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=3D# 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