在使用Hologres的json_populate_recordset函数处理json数组时,可以用表里的字段替换第二个参数。举个例子:
假设有一个名为 my_table 的表,它的结构如下所示:
| 字段名 | 数据类型 |
| ——– | ——- |
| id | integer |
| name | text |
| attributes | jsonb |

我们可以使用下面的SQL语句来读取表中的json数组内容:

SELECT * FROM json_populate_recordset(NULL::my_table,                              attributes);

在这个例子中,我们用 NULL::my_table 替换了原来的表名,并用 attributes 替换了原来的json数组。这样做可以让 json_populate_recordset 函数返回一个新的虚拟表,该表中的每一行都是 my_table 表中的一行,以及其 attributes 字段中对应的json数组元素。