array_agg returns [null] instead of [] when it can not find any rows, thus the range enters the loop, but it fails to convert the null to string.
array_agg returns [null] instead of [] when it can not find any rows, thus the range enters the loop, but it fails to convert the null to string.