I am running postgresql with pgAdmin4 on windows x64. I just created a database, then a table and now I want to add data to the table from an excel sheet using
copy table from 'C:\Users\username\Desktop\copy.csv' delimiter ',' csv header;
I get this error message:
ERROR: could not open file "C:\Users\username\Desktop\copy.csv" for reading: Permission denied HINT: COPY FROM instructs the PostgreSQL server process to read a file. You may want a client-side facility such as psql's \copy. SQL state: 42501
I tried running it as admin but it didn't help. Side note: pgadmin 4 opens on my Firefox browser with high privacy settings in case it has anything to do with it.
For people who are still having this issue, one of the fastest workarounds I found (that sidesteps permission changes) is to use the "Users\Public" folder when reading or writing files.
E.g if you want to read in "copy.csv", moving the file's location to "Users\Public\copy.csv" should allow you to read it without explicitly setting permissions for postgres/pgadmin
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With