Casting json (or jsonb) to real

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a jsonb column which just stores a value, not an object with key/value, e..g

"right"
"[0.563426, -0.104352, 0.819550]"
"[-1.024841, -0.235817, 0.591118]"
"1.4531"

When I know this value is a floating point value I would just like to cast

SELECT value::real but you can't do that. You can do SELECT (jsonbcol->>'somekey')::real, but these columns just store a value.

What are my options here? This is json data, sometimes it is an array, etc, but for certain rows I know it to be a floating point value.

--
Wells Oliver
wells.oliver@xxxxxxxxx

[Index of Archives]     [Postgresql Home]     [Postgresql General]     [Postgresql Performance]     [Postgresql PHP]     [Postgresql Jobs]     [PHP Users]     [PHP Databases]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Forum]

  Powered by Linux