I have a json type field in postgresql. However I can't select rows where specific field is null:
Code:
SELECT *
FROM json_array_elements(
'[{"name": "Toby", "occupation": "Software Engineer"},
{"name": "Zaphod", "occupation": "Galactic President"} ,
{"name2": "Zaphod", "occupation2": null} ]' ) AS elem
where elem#>'{occupation2}' is null
This should work but I am getting this error:
ERROR: operator does not exist: json #> boolean
LINE 6: where elem#>'{occupation2}' is null