i.e.,
array_agg(t.uuid) should result output type of string[] (assuming uuid is a string)
i.e.,
json_build_object(
'id', g.id,
'uuid', g.uuid,
'latitude', g.latitude,
'longitude', g.longitude,
)
should have result output type of { id: number, uuid: string, latitude: number, longitude: number } (assuming normal geocode table is being queried)
also,
coalesce should check the inputs and if one of them is not nullable (e.g., array[]::string[]) then null should not be an output candidate