Re: Malformed array literal in goin from jsonb to real[] - Mailing list pgsql-admin

From Erik Wienhold
Subject Re: Malformed array literal in goin from jsonb to real[]
Date
Msg-id 59706540.193641.1678378377504@office.mailbox.org
Whole thread Raw
In response to Re: Malformed array literal in goin from jsonb to real[]  (Erik Wienhold <ewie@ewie.name>)
List pgsql-admin
> On 09/03/2023 17:05 CET Erik Wienhold <ewie@ewie.name> 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



pgsql-admin by date:

Previous
From: Erik Wienhold
Date:
Subject: Re: Malformed array literal in goin from jsonb to real[]
Next
From: Piergiorgio Valli
Date:
Subject: Re: postgresql to Oracle database migration