您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

Spring Data本机查询不允许Postgres jsonb字符串存在运算符(问号)

Spring Data本机查询不允许Postgres jsonb字符串存在运算符(问号)

Postgresql中的所有运算符都使用基础过程:

> SELECT oprname, oprcode FROM pg_operator WHERE oprname LIKE '%?%'

oprname | oprcode
--------------------------
?       | jsonb_exists
?|      | jsonb_exists_any
?&      | jsonb_exists_all
...

因此,您可以使用以下方式重写查询jsonb_exists(jsonb, text)

SELECT t.id
FROM task AS t
WHERE jsonb_exists(t.worker_ids, :workerId)
ORDER BY t.created_at
Postgres 2022/1/1 18:15:48 有492人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶