【发布时间】:2021-09-09 19:12:19
【问题描述】:
在 postgres 中找不到合适的查询来格式化 jsonb 输出 我的表中有一个 jonb 列。
Table: Users
id| posts
--------
1 | [{'title': '', 'is_published': '', 'description': '', 'some': 'extra'}, ...]
2 | [{'title': '', 'is_published': '', 'description': '', 'some': 'extra'}, ...]
如何选择帖子列以仅包含某些字段?比如:
id| posts
--------
1 | [{'title':'', 'description': ''}, ...]
2 | [{'title':'', 'description': ''}, ...]
有什么想法吗?
PS:postgres的版本是最新的12、13、14...
【问题讨论】:
-
请提供足够的代码,以便其他人更好地理解或重现问题。
标签: sql postgresql jsonb