How I output select into a file?
I try
SELECT * FROM table \g filename
but I get “filename: Permission denied”
Either the file already exists and you have no write permission, or you have no write permission on your current working directory.
Try an absolute path:
SELECT * FROM atable \g /writable/directory/filename
SELECT customer_email AS email.psql client, it is not part of SQL.