When I want a query result as a CSV file, I would rather not deal with file permissions on the database server. The SQL COPY command writes on the server, so it needs the right privileges and a path that server can write to. psql has a client-side twin that writes where you are.
\copy (SELECT id, email FROM users WHERE active) TO 'users.csv' WITH (FORMAT csv, HEADER)
The docs explain that \copy runs an SQL COPY but psql itself reads or writes the file, so file access and privileges are those of the local user and no superuser rights are needed. You can copy a whole table or, as above, the result of a query in parentheses. FORMAT csv gives comma-separated output and HEADER puts the column names on the first line.
The same command also works the other way round, to load a file:
\copy users FROM 'users.csv' WITH (FORMAT csv, HEADER)
On input, HEADER makes COPY skip the first line. There is also HEADER MATCH, which discards the first line only if it matches the table’s column names exactly, and raises an error otherwise.
The caveat is the parsing. The docs say that for \copy the whole rest of the line is taken as arguments, and no variable interpolation or backquote expansion happens. It also has to fit on one line. If you need psql variables or a multi-line query, use COPY ... TO STDOUT and end it with \g users.csv, which the docs mention as an alternative.
The new file is plain text with your data in it, so put it somewhere sensible.
Further reading: PostgreSQL documentation: psql (\copy), PostgreSQL documentation: COPY
Going deeper: Moving on from hdtv: how to export your TV show list to Trakt.tv