数据仓库服务 GAUSSDB(DWS)-JSON/JSONB函数:jsonb_to_recordset(array-json)

时间:2024-12-06 15:12:47

jsonb_to_recordset(array-json)

描述:参考函数jsonb_to_record,对数组内个每个元素,执行上述函数的操作,因此这要求数组内的每个元素都得是object-jsonb。

返回类型:setof record

示例:

1
2
3
4
5
6
SELECT * FROM jsonb_to_recordset('[{"a":1,"b":"foo","d":false},{"a":2,"b":"bar","c":true}]') AS x(a INT, b text, c boolean);
 a |  b  | c
---+-----+---
 1 | foo |
 2 | bar | t
(2 rows)
support.huaweicloud.com/sqlreference-910-dws/dws_06_0356.html