Je moet ->>
casten tekenreeks resultaatwaarden:
WITH mytable(json_field) AS ( VALUES
('{"power": 200}'::JSONB),
('{"power": 400}'::JSONB),
('{"power": 0}'::JSONB),
('{"power": 146297}'::JSONB)
)
SELECT * FROM mytable where (json_field->>'power')::INTEGER < 2;
Resultaat is:
json_field
--------------
{"power": 0}
(1 row)