json массив к строке в Postgresql
SELECT string_agg(trim(tdata::text, '"'), ', ') from jsonb_array_elements(CAST('[1 , 2]' as jsonb)) tdata
Envious Earthworm
SELECT string_agg(trim(tdata::text, '"'), ', ') from jsonb_array_elements(CAST('[1 , 2]' as jsonb)) tdata
SELECT
ID
,(
SELECT string_agg(trim(JsonString::text, '"'), ', ')
FROM jsonb_array_elements(JsonData->'Name') JsonString
) AS StringArray
FROM tbl_TestJsonArray;
SELECT info ->> 'customer' AS customer,
info -> 'items' ->> 'product' AS product
FROM orders
WHERE CAST ( info -> 'items' ->> 'qty' AS INTEGER) = 2