Skip to content
Advertisement

PostgreSQL verify an empty array on json

I have the following row on select

I have to Identify empty jsons, then manually add a value to it (eg row 1 and 3 ), I tried the following :

But the “is null” verification fails for this type of data (array of json), how to identify ‘[]’ values in this case?

Note: I only have select permission on this db

Advertisement

Answer

Casting the json to text before comparison worked for this case : ” case when jsondata::text = '[]'

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement