Search Postgresql Archives

json_array_elements_text?

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

 



Hello,

I'm trying to unpack a json array into it's constituent text values so I can join them to a table. I can successfully unpack json values, but am having trouble converting these to text so I can cast them to the UUIDs needed for the join.

http://dba.stackexchange.com/questions/54283/how-to-turn-json-array-into-postgres-array suggest using trim, and this does work:

SELECT trim(json_array_elements(biosample.properties->'treatments')::text, '"')::uuid
FROM object biosample WHERE biosample.item_type = 'biosample'

But it seems kinda ugly. Am I missing something obvious or is postgres 9.3 just missing a json_array_elements_text function?


Laurence

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux