I replaced the question mark operator :
SELECT * FROM tracks WHERE artistnames @> '"The Dirty Heads"'
I don't know if there are performance differences between the two search operators. More infos: http://www.postgresql.org/docs/current/interactive/functions-json.html#FUNCTIONS-JSONB-OP-TABLE
Hello, I've answered a similar question on stackoverflow, using the function call instead of ? operator might be an alternative.
SELECT oprname, oprcode FROM pg_operator WHERE oprname = '?'
on my database it's jsonb_exists function, then you can update your query as:
Track::whereRaw("jsonb_exists(artistnames, 'The Dirty Heads')")->first();
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community