I think string_agg
vs array_agg
is almost same when one is return string type and another is return array type. Is there any other difference between them?
Which should I prefer? First or second?
array_agg(tag_name, ',') as Tag
OR
string_agg(tag_name, ',') as Tag
OR
array_to_string(array_agg(tag_name), ',') as Tag
Can anyone explain it for me? 1.array_agg 2. string_agg 3. array_to_string