Dalitos
Dalitos

Reputation: 109

PostgreSQL filter by column with json

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?

Upvotes: 0

Views: 101

Answers (2)

Laurenz Albe
Laurenz Albe

Reputation: 246858

Sounds like a simple WHERE condition:

WHERE jsoncol::text = '[null]'

Upvotes: 1

Dalitos
Dalitos

Reputation: 109

i found this solution: jsoncol ->>0 IS Null

Upvotes: 0

Related Questions