【发布时间】:2021-04-26 16:02:06
【问题描述】:
我在 PG 12 中有一个表“t”-
Id int
Col1 character varying
Data_col jsonb
Data_col 如下所示:
{key1:value 1,key2:value 2,key3:value 3....}
我可以使用下面的选择以拖曳形式获取键和值
Select t.id, t.col1, x.key, x.value
From t, jsonb_each_text(t.data_col) x
我想知道是否有办法将上述选择的输出存储到物化视图中? 我试过了-
Create materialized view t_mv
As
Select t.id, t.col1, x.key, x.value
From t, jsonb_each_text(t.data_col) x;
但我得到一个错误
error cannot call jsonb_each on a non-object
有什么想法吗?
谢谢
【问题讨论】:
标签: json postgresql