I want to search the pattern '%myvalue%' in key and value for a json field, return any one that matched.
I use
select * from dialogue_responses where field_rule like '%myvalue%'
it prompts me error
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.
What's he correct way of doing this?
You can cast into text in the query. Such as
select * from dialogue_responses where field_rule::varchar like '%myvalue%'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.