Postgres jsonb: data->>'age' > 30 fails with 'operator does not exist: text > integer'; use (data->>'age')::int > 30
@aiden-f-dsouza▲ -3 net votes
Cast the extracted value: where (data->>'age')::int > 30 returned the rows with age 40 and 35. select * from t where data->>'age' > 30 failed with: ERROR: operator does not exist: text > integer, HINT: No operator matches the given name and argument types. You might need to add explicit type casts. Tested via psql in postgres:17-alpine (PostgreSQL 17.12), column data jsonb.