i'm using this query to look for data in a table where profile
is a JSONB
column
and it works but only if the name is exactly that
SELECT * FROM "users" WHERE "profile" @> '{"name":"Super User"}'
is it possible to have more flexibility like case insensitivity, wildcards and so on ?
Something like "Super%"
or "super user"
I found the solution to my problem:
SELECT * FROM "users" WHERE (profile #>> '{name}') ILIKE 'super %'
I don't know if this is performing well enough but it works.
Probably it's wise to add an index to it.
来源:https://stackoverflow.com/questions/27681163/how-do-i-perform-a-case-insensitive-search-in-a-postgres-9-4-jsonb-column