I have a table in Postgres 9.6 db that is structured like this:
Table "public.pricings"
Column | Type | Modifiers
---------------------------+-----------------------------+-------------------------------------------------------
id | integer | not null default nextval('pricings_id_seq'::regclass)
unconfirmed_matrix_prices | jsonb | not null default '"{}"'::jsonb
I'm new to using jsonb.
I'd like to search for any unconfirmed_matrix_prices that are empty(ie the default). I see I can do something like this:
solar_dev=# select count(*) from json_object_keys('{"f1":1,"f2":2}');
count
-------
2
(1 row)
Is there a way I can do a where phrase where json_object_keys is equal to 0? I know a bit of a runaround way - Is there a better way?
json, only forjsonb. https://dba.stackexchange.com/questions/64759/how-to-remove-known-elements-from-a-json-array-in-postgresql/64765#64765 – Erwin Brandstetter Oct 21 '17 at 13:36