PostgreSQL Export to CSV. Each element of array in new line
Test:

\copy (
  SELECT CASE WHEN users.name = LAG(users.name) OVER (ORDER BY users.name, 
                                                               users.email, 
                                                               addresses.address) 
              THEN '' 
              ELSE users.name
              END, 
         emails.email, 
         addresses.address
  FROM users
  LEFT JOIN emails USING(id)
  LEFT JOIN addresses USING(id)
  ORDER BY users.name, 
           users.email, 
           addresses.address
) TO 'path/to/file.csv' WITH csv header;