Oleg,

1 | {"group_id": 1}
2 | {“group_id": 1}
3 | {“group_id": 2}
4 | {“group_id": 3}


PS: Please note that I am currently at postgres 9.5. An update, if
necessary, would be possible though.

Upgrade, please !

I have only master 11beta2 right now:

select * from qq  where js @> '{"group_id":1}';
 id |       js
----+-----------------
  1 | {"group_id": 1}
  2 | {"group_id": 1}
(2 rows)


thanks for your answer. Your code does work fine on 9.5 already; what I would like to achieve is to get records where the group_id entry is 1 or 2, and a fear that

select * from mytable where (metadata @> '{"group_id":1}') OR (metadata @> '{"group_id”:2}’)

- while doable - would not make the best use of existing indices.

Any more ideas?
Best,
/eno


Reply via email to