There is a json_agg resulting in [10,20] or [null]. I want to filter all rows with [null] in the column. How is it possible to achieve this?
2 Answers
Sounds like a simple WHERE condition:
WHERE jsoncol::text = '[null]'
3 Comments
Dalitos
Then i get this error: ERROR: operator does not exist: json = json LINE 78: ) x WHERE x.geometry = '[null]'::json ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. SQL state: 42883 Character: 3910
Laurenz Albe
Sorry, I have fixed the answer.
i found this solution: jsoncol ->>0 IS Null
3 Comments
Laurenz Albe
That would also be true for a JSON like
[null,42,"x"].Dalitos
hm, do you have another solution?
Laurenz Albe
Yes, see my answer.