Discussion:
Small annoyance with COPY FROM
(too old to reply)
James David Smith
2012-09-28 08:59:47 UTC
Permalink
Hi all,

Not really a big issue, but just something which catches me out
sometimes and I'm not sure if it's just me. When I want to import data
from a CSV file I write the below:

COPY temp_import_table
FROM 'X:/aerasense_12-7-2012.csv' DELIMITERS ',' CSV HEAD

But get the error:

ERROR: could not open file "X:/aerasense_12-7-2012.csv" for reading:
No such file or directory

However when I move the file to within the PostgreSQL directory of my
C: drive it works fine:

COPY temp_import_table
FROM 'C:/Program Files
(x86)/PostgreSQL/9.0/data/aerasense_12-7-2012.csv' DELIMITERS ',' CSV
HEADER;

Am I doing something wrong, or can PostgreSQL only import data from
it's own directory?

Thanks

James
--
Sent via pgsql-novice mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice
Johan Nel
2012-09-28 12:56:14 UTC
Permalink
James,
Post by James David Smith
Not really a big issue, but just something which catches me out
sometimes and I'm not sure if it's just me. When I want to import data
COPY temp_import_table
FROM 'X:/aerasense_12-7-2012.csv' DELIMITERS ',' CSV HEAD
No such file or directory
However when I move the file to within the PostgreSQL directory of my
Am I doing something wrong, or can PostgreSQL only import data from
it's own directory?
I think it is a permission issue. Make sure the user (postgres) have at least read permissions to the folder.

Regards,

Johan Nel

Loading...