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 1paIt6-0007RN-OH for pgsql-admin@arkaria.postgresql.org; Thu, 09 Mar 2023 16:13:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1paIt5-0001qF-G2 for pgsql-admin@arkaria.postgresql.org; Thu, 09 Mar 2023 16:13:03 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1paIt5-0001q5-57 for pgsql-admin@lists.postgresql.org; Thu, 09 Mar 2023 16:13:03 +0000 Received: from mout-u-204.mailbox.org ([80.241.59.204]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1paIt2-00043f-OU for pgsql-admin@postgresql.org; Thu, 09 Mar 2023 16:13:02 +0000 Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-204.mailbox.org (Postfix) with ESMTPS id 4PXZ3F6kNYz9sTk; Thu, 9 Mar 2023 17:12:57 +0100 (CET) Date: Thu, 9 Mar 2023 17:12:57 +0100 (CET) From: Erik Wienhold To: Wells Oliver , pgsql-admin Message-ID: <59706540.193641.1678378377504@office.mailbox.org> In-Reply-To: <84644851.192870.1678377956057@office.mailbox.org> References: <84644851.192870.1678377956057@office.mailbox.org> Subject: Re: Malformed array literal in goin from jsonb to real[] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Normal X-Rspamd-Queue-Id: 4PXZ3F6kNYz9sTk List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 09/03/2023 17:05 CET Erik Wienhold wrote: > > Use jsonb_populate_record with a custom type: > > create type myrec as (col real[][]); > > select * from jsonb_populate_record(null::myrec, '{"col":[[0,1],[2,3]]}'); > > col > --------------- > {{0,1},{2,3}} > (1 row) I just noticed that it's also possible without a custom type: select * from jsonb_to_record('{"col":[[0,1],[2,3]]}') as t(col real[]); -- Erik