I'm starting to build an API using Laravel with PostgreSQL as the data source. From what I've read so far, Laravel's Eloquent ORM currently does not support querying indexed JSON (April 2014). For example, the following simple query is not (currently) possible in Eloquent:
SELECT * FROM mytable WHERE json_data->>'firstname' = 'Paul'
As a result, it looks like I'm manually building queries until Eloquent supports it.
As this is an API, we'll need to take data from the URL/cURL query strings:
https://myapi.com/api/v1/people?firstname=Paul
results in
SELECT * FROM people WHERE json_data->>'firstname' = 'Paul'
Assuming that I do my best to sanitise the incoming query strings, am I taking a bit of a risk performing straight queries on JSON field data? Seeing as the JSON data type has not been around so long I'm still evaluating it for use within this project.