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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With