The classic SQL Server pattern for row concatenation is STUFF with a correlated subquery and FOR XML PATH. In PostgreSQL, STRING_AGG with ORDER BY inside GROUP BY solves the same case with less code.
STRING_AGG equivalent
PostgreSQL
SELECT d.department, STRING_AGG(e.name, ', ' ORDER BY e.name) AS names FROM departments d JOIN employees e ON e.dept_id = d.id GROUP BY d.id, d.department;