Malformed array literal in goin from jsonb to real[]

From: Wells Oliver <wells(dot)oliver(at)gmail(dot)com>
To: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Malformed array literal in goin from jsonb to real[]
Date: 2023-03-09 15:19:59
Message-ID: CAOC+FBWKkoHWmCu+RtkTcJ76FkeqaNTSuPVtzvp=SBK6xbv+kQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

This value exists in my jsonb column:

[[-0.7452975, -0.21457797, 0.631259], [0.66549873, -0.2969812, 0.6847727],
[0.04053491, 0.9304614, 0.3641407]]

Which obviously blows up when doing (jsonb->>col)::real[] with malformed
array literal.

Is there a convenient function to do this casting or do I need to do some
awful string munging?

--
Wells Oliver
wells(dot)oliver(at)gmail(dot)com <wellsoliver(at)gmail(dot)com>

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Erik Wienhold 2023-03-09 16:05:56 Re: Malformed array literal in goin from jsonb to real[]
Previous Message Tom Lane 2023-03-09 14:35:49 Re: database collation "C" and "C.LATIN1"