Search Postgresql Archives

Re: Trouble matching a nested value in JSONB entries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux