I use pgAdmin4 and postgresql 10 on a window 10 laptop. When I use a COPY FROM to import a CSV file
COPY BD.CP FROM 'C:\Users\NOMUSER\Desktop\MONDOSSIER\Fichier.csv' with delimiter ';';
PGS returns an error message of Permission denied :
ERROR: ERREUR: n'a pas pu ouvrir le fichier « C:\Users\NOMUSER\Desktop\MONDOSSIER\Fichier.csv » pour une lecture : Permission denied
HINT: COPY TO indique au serveur PostgreSQL de lire un fichier. Vous pourriez vouloir utiliser la fonctionnalité \copy de psql pour lire en local.
SQL state: 42501
What is the problem please ? I look at a solution but I do not find! Thanks a lot :)``
Use \copy instead of just "copy".
COLS=STATE,COUNTY,LINK_ID
psql -d tosm -c "\COPY alias ($COLS) FROM 'alias.txt' (FORMAT CSV, HEADER, DELIMITER('|'))";
Ok, so you (and I) need to change the user authorization of the destination folder from where you want to COPY FROM or COPY TO. At the installation of Postgresql, windows does not create a new service named postgresql but uses Network service. So in the properties of your folder, you need to authorize "Network Service" as a user and to give "total control" on the folder. I have done it and it is ok for now!
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