with t(i) as (select 1 union all select 2 union all select 3) select array_agg(i) as result from t ; result ----------- [3, 2, 1]
with t(i) as (select 1 union all select 2 union all select 3) select array_join(array_agg(i),',') as result from t ; result -------- 1,3,2