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

时间:2024-09-24 15:54:38

jsonb_to_record(object-json)

描述:正如所有返回record的函数一样,调用者必须用一个AS子句显式地定义记录的结构。会将object-json的键值对进行拆分重组,把键当做列名,去匹配填充AS显示指定的记录的结构。

返回类型:record

示例:

1
2
3
4
5
SELECT * FROM jsonb_to_record('{"a":1,"b":"foo","c":"bar"}'::jsonb) as x(a int, b text, d text);
 a |  b  | d
---+-----+---
 1 | foo |
(1 row)
support.huaweicloud.com/sqlreference-910-dws/dws_06_0356.html