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 1qYQIv-001efR-0x for pgsql-hackers@arkaria.postgresql.org; Tue, 22 Aug 2023 12:16:13 +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 1qYQIs-000UDs-Pc for pgsql-hackers@arkaria.postgresql.org; Tue, 22 Aug 2023 12:16:10 +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 1qYQIs-000UDa-DT for pgsql-hackers@lists.postgresql.org; Tue, 22 Aug 2023 12:16:10 +0000 Received: from anastigmatix.net ([68.171.216.17]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qYQIo-000MgA-EX for pgsql-hackers@postgresql.org; Tue, 22 Aug 2023 12:16:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=anastigmatix.net; s=default; h=Content-Transfer-Encoding:Content-Type: Message-ID:References:In-Reply-To:Subject:Cc:To:From:Date:MIME-Version:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=lNBir2kEJWrzQ5lFqbLAKvQ+uRWXFNcaSN71530vPag=; b=BWLsFDoYjWhlu0CdZywgzW9tku MJGqOp3m+sApn4h99JDKjV/ylXj4HoXefX2W1zEb7GTSLu1hExuJ329JRxgNVZnw8XQSqZ4LTzwRC 2CaO+adaHiABKlSPX/Ytuf/Rxwcjj/46bth12/Fuut9j64dj5X4EOwMR1kSQBUJV0mkhxzHrnZbzB LiEYTpqfRjGbWRBKPhJjByRXNTUxWGtOCeOhDU9OWBlNvAhC0oHmmRk2yva0kslXW0HFtdsO3hI5V G/207aDoVBPlTKmmpn7UDkrre8+YXxb5lGmO4ztopuhGjNZ94BomyYjkhyaYlc20ebl0NC3+Gu7PR YRWBayQQ==; Received: from [::1] (port=48526 helo=adam.ace-host.net) by adam.ace-host.net with esmtpa (Exim 4.96) (envelope-from ) id 1qYQIh-000eUp-2R; Tue, 22 Aug 2023 08:16:03 -0400 MIME-Version: 1.0 Date: Tue, 22 Aug 2023 08:16:02 -0400 From: Chapman Flack To: Andy Fan Cc: jian he , Pavel Stehule , Tom Lane , pgsql-hackers Subject: Re: Extract numeric filed in JSONB more effectively In-Reply-To: References: <3507485.1691090027@sss.pgh.pa.us> <900892914fdc3f477b101d699efb40e0@anastigmatix.net> <903341.1692022214@sss.pgh.pa.us> <4b97f1a1dd9b6e45443d24870d3be698@anastigmatix.net> <111272f2dc112c7becdd35ad89f6b935@anastigmatix.net> <5138c6b5fd239e7ce4e1a4e63826ac27@anastigmatix.net> User-Agent: Roundcube Webmail/1.6.0 Message-ID: <369543439e988ae43f0a6307500b27c4@anastigmatix.net> X-Sender: chap@anastigmatix.net Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - adam.ace-host.net X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - anastigmatix.net X-Get-Message-Sender-Via: adam.ace-host.net: authenticated_id: chap@anastigmatix.net X-Authenticated-Sender: adam.ace-host.net: chap@anastigmatix.net X-Source: X-Source-Args: X-Source-Dir: X-From-Rewrite: unmodified, already matched List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2023-08-22 01:54, Andy Fan wrote: > After we label it, we will get error like this: > > select (a->'a')::int4 from m; > ERROR: cannot display a value of type internal Without looking in depth right now, I would double-check what relabel node is being applied at the result. The idea, of course, was to relabel the result as the expected result type, not internal. (Or, as in the restructuring suggested earlier, to use a finish function whose return type is already as expected, and needs no relabeling.) Regards, -Chap