In Sql Server you can run the following query to combine values from multiple rows into a single string variable.
DECLARE @x NVARCHAR(MAX) = N'';
SELECT TOP 5 @x = @x + name + ', '
FROM sys.objects
SELECT @x
Which results in
"sysrscols, sysrowsets, sysclones, sysallocunits, sysfiles1,"
Is there a way to do something similar in PostgreSql? I've tried creating a PostgreSql function that does a SELECT INTO stringVariable but that is only resulting in a single row's worth of values.