[英]Search Postgres JSONB fields
我想在键和值中搜索模式'%myvalue%'以获得json字段,返回任何匹配的内容。
我用
select * from dialogue_responses where field_rule like '%myvalue%'
它提示我错误
ERROR: operator does not exist: jsonb ~~ unknown
LINE 1: select * from dialogue_responses where field_rule like '%auf...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
他这样做的正确方法是什么?
您可以在查询中转换为文本。 如
select * from dialogue_responses where field_rule::varchar like '%myvalue%'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.