[英]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.