Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 2 years ago.
0

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

Last updated 9 years ago.
0

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();
Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

younes0 younes0 Joined 1 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.