The JSQuery extension is a PostgreSQL extension developed by Postgres Professional. You can get the source code and instructions for use at https://github.com/postgrespro/jsquery. JSQuery is a fairly easy compile install if you are on a Nix system. It provides more query functionality and additional index operator classes to support for JSONB than you get in built in PostgreSQL. It is supported for PostgreSQL 9.4 and above.
We've built windows binaries for PostgreSQL 64-bit 9.4, 9.5, 9.6, and 10beta1. The 9.4 64-bit will only install on the EDB PostgreSQL 9.4 64-bit distribution. The 9.5 and 9.6 are compatible with both PostgreSQL EDB and BigSQL distributions. The 10 has only been tested on BigSQL, but should work on EDB when it comes out. We should have 32-bit versions later and will link to those here.
After you have copied the binary files to your install, you can install the extension with:
CREATE EXTENSION jsquery;
To test do the following query:
SELECT f.data->>'name' AS name
FROM (VALUES ('{"age": 3, "name": "Ellie"}'::jsonb) ,
('{"age": 4, "name": "Peger"}'::jsonb) ) AS f(data)
WHERE f.data @@ '"age" > 3';
Should give you:
name ------- Peger (1 row)