cant export from pgadmin to csv on mac (permission denied)

1,363 views
Skip to first unread message

Elad Meir

unread,
Jun 26, 2020, 11:46:56 AM6/26/20
to Google Cloud SQL discuss
Hello,

Im trying to export table data from PGadmin as follows:

COPY db_name.table_name TO '/tmp/New Folder/first_list_data.sql' DELIMITER ',' CSV HEADER


And I get the error:

ERROR: could not open file "/tmp/New Folder/first_list_data.sql" for writing: Permission denied HINT: COPY TO instructs the PostgreSQL server process to write a file. You may want a client-side facility such as psql's \copy. SQL state: 42501

how can I allow PGadmin to export this file to my mac?

thanks




David (Google Cloud Support)

unread,
Jun 27, 2020, 12:45:09 PM6/27/20
to google-cloud...@googlegroups.com
Hello,
This is a discussion group for the Cloud SQL product, which is not affiliated to pgAdmin. For that reason, the support you would get for permission issue your are facing with pgAdmin would be limited here, and this would be better addressed on StackOverflow in the future.

Nevertheless, I have found a Stack post for the same error message when attempting to import a file on Windows 7. That error is likely caused by the user not having read permission to that file, and needs to be added.
Since that way to modify permissions is for Windows, you would need to do so using Mac's Terminal.

Alternatively, I believe that this article might interest you, as it mentions the use of psql's \copy, just like the error message, and the pgAdmin GUI. For psql, the command would be `$ \copy table_name to 'filename.csv' csv header` as per this link.
Reply all
Reply to author
Forward
0 new messages