Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rctIs-002iOS-Sq for pgsql-bugs@arkaria.postgresql.org; Wed, 21 Feb 2024 20:34:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rctIq-006QqJ-DC for pgsql-bugs@arkaria.postgresql.org; Wed, 21 Feb 2024 20:34:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rctIq-006Qq4-50 for pgsql-bugs@lists.postgresql.org; Wed, 21 Feb 2024 20:34:52 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rctIo-000E3g-5U for pgsql-bugs@lists.postgresql.org; Wed, 21 Feb 2024 20:34:52 +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 41LKYmne131236; Wed, 21 Feb 2024 15:34:48 -0500 From: Tom Lane To: Laurenz Albe cc: ewherrmann@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18356: Casting values from jsonb_each_text does not respect WHERE filter with sub select In-reply-to: <2df3715aa60088b5d781c6b4b1dc1ec5ab62669b.camel@cybertec.at> References: <18356-a811d014209fd19c@postgresql.org> <2df3715aa60088b5d781c6b4b1dc1ec5ab62669b.camel@cybertec.at> Comments: In-reply-to Laurenz Albe message dated "Wed, 21 Feb 2024 21:23:53 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <131234.1708547688.1@sss.pgh.pa.us> Date: Wed, 21 Feb 2024 15:34:48 -0500 Message-ID: <131235.1708547688@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Laurenz Albe writes: > On Wed, 2024-02-21 at 19:13 +0000, PG Bug reporting form wrote: >> However as of v16, this same statement causes the error: 'invalid input >> syntax for type double precision: "Volume"'. > That's not a bug. PostgreSQL just chose a different execution plan > that happened to evaluate the SELECT list elements before filtering out > the rows. I'm not sure if it's a bug or not. I think we do promise that WHERE filtering happens before SELECT list evaluation, and this query looks like it ought to meet that condition. But without a self-contained example it's hard to be entirely sure what's happening. regards, tom lane