Say I have a table in a PostgreSQL database like
id | json_field
---+-----------
1 {"name":"foo","age":20}
2 {"name":"bar", "age":10, "alive":1}
.
.
I can get the data for json_field where name=="foo" by doing
SELECT * from my_table where json_field@>"{'name':'foo'}"
or
SELECT * from my_table where (json_field->>'name')='foo'"
Since the first query is way faster (it is indexed as far as I understand, where the second have to loop through each record and check) is there a way to do other conditons like "greater than", "is in", "is not" e.g (some pseudo-code)
SELECT * from my_table where json_field@>"{'name':is not 'foo'}"
SELECT * from my_table where json_field@>"{'name':>'foo'}"
SELECT * from my_table where json_field@>"{'age':is in '(20,50)'}"