Home > Back-end >  Postgresql copy command not finding file
Postgresql copy command not finding file

Time:10-12

when running:

~/fidelity/releases/20220907033831$ ls -a
.
..
.browserslistrc  
221005_users_all.csv
_private

the presence of a file is confirmed.

However, when launching a postgresql command

psql fidelity_development
COPY users (id,migrated_id,[...]) FROM '~/fidelity/releases/20220907033831/221005_users_all.csv'  DELIMITER ';' CSV HEADER;

The response is unexpected: ERROR: could not open file "~/fidelity/releases/20220907033831/221005_users_all.csv" for reading: No such file or directory

What am I missing to determine why postgresql cannot see this file?

note this directory was also simlinked as fidelity/current and the same result was obtained when referring to that directory for the file, whereas bash sees it.

CodePudding user response:

Use \COPY command as this one is client based and handles the local path correctly.

While COPY is server based and this could cause issues finding your file.

  • Related