0
I am having a lot of difficulty trying to import the CSV file using PostgreSQL
, apparently the program is not able to read the file, but granted permission in all users and folders of the operating system and the program itself.
I saw on some site to use this syntax, but it shows error when executing the command.
psql\copy maquinas
from 'E:\Mídia\Cursos\SQL Server\Postgres\LogMaquinas.csv'
delimiter ','
csv header;
Follow message that appears when trying to execute
this file exists in the folder?
– novic
try changing each
\
by two\\
in the file name: 'E: Media Courses SQL Server Postgres Logmaquinas.csv' - I can’t confirm now if this is the case for postgresql, but many programming languages reserve the\
as an escape character to put special characters in the string. (inclusive to quote a single\
here at stackoverflow gives problem - need to put a space together)– jsbueno
Note that the suggested is to run the command
\copy
customer’spsql
, I don’t think psql is running, but some other client program is running. I think I’m running the commandCOPY
on the server machine and not on the client https://www.postgresql.org/docs/current/sql-copy.html.– anonimo
As jsbueno commented the manual, in the documentation of the SQL COPY command it says: "filename The path name of the input or output file. An input file name can be an Absolute or relative path, but an output file name must be an;"
– anonimo