Postgres - How to check for an empty array
You can use the fact that array_upper and array_lower functions, on empty arrays return null , so you can:
select count(*) from table where array_upper(datasets, 1) is null;
The syntax should be:
SELECT
COUNT(*)
FROM
table
WHERE
datasets = '{}'
You use quotes plus curly braces to show array literals.