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 1rct2a-002goz-II for pgsql-bugs@arkaria.postgresql.org; Wed, 21 Feb 2024 20:18:05 +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 1rct2Y-006Jiw-Ux for pgsql-bugs@arkaria.postgresql.org; Wed, 21 Feb 2024 20:18:03 +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 1rct2Y-006JiN-MT for pgsql-bugs@lists.postgresql.org; Wed, 21 Feb 2024 20:18:03 +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 1rct2W-000DwN-DH for pgsql-bugs@lists.postgresql.org; Wed, 21 Feb 2024 20:18:02 +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 41LKHwCG123110; Wed, 21 Feb 2024 15:17:58 -0500 From: Tom Lane To: ewherrmann@gmail.com cc: 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: <18356-a811d014209fd19c@postgresql.org> References: <18356-a811d014209fd19c@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Wed, 21 Feb 2024 19:13:24 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <123108.1708546678.1@sss.pgh.pa.us> Date: Wed, 21 Feb 2024 15:17:58 -0500 Message-ID: <123109.1708546678@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > - Prior to v16, this statement would work for casting values of a k/v jsonb > pair to an integer: > SELECT id, mytdata.key, mytdata.value::integer > FROM my_table as myt, > jsonb_each_text(myt.data) as mytdata > WHERE mytdata.key IN ( SELECT key from week_key_table > ) > - Where week_key_table stores keys such as "week01", "week02", and > "week03". > - And where the jsonb has some keys with alphanumeric values and some keys > with numeric values, such as: { "key_figure": "Volume", "week01": "0", > "week02": "0", "week03": "0"} > However as of v16, this same statement causes the error: 'invalid input > syntax for type double precision: "Volume"'. Could you provide an actually self-contained example? People have other things to do than guess about the data and table details needed to reproduce this. regards, tom lane