Re: import CSV file - Mailing list pgsql-sql

From D'Arcy J.M. Cain
Subject Re: import CSV file
Date
Msg-id 20070313182740.ef40e742.darcy@druid.net
Whole thread Raw
In response to import CSV file  (T E Schmitz <mailreg@numerixtechnology.de>)
Responses Re: import CSV file
Re: import CSV file
List pgsql-sql
On Tue, 13 Mar 2007 20:38:33 +0000
T E Schmitz <mailreg@numerixtechnology.de> wrote:
> I am trying to batch-load a tab-separated CSV file:
> 
> psql -h lolek  -U tes -d stockmarket -c "copy history from 
> '/tmp/FTSE.csv' CSV";
> 
> ERROR:  could not open file "/tmp/FTSE.csv" for reading: No such file or 
> directory
> 
> The file exists. Do I need to escape the quotes?

From the "-h" option I assume that the server is not on the local
machine and hence the file is not available to the server.  You need to
do something like this:
 psql -h lolek  -U tes -d stockmarket -c "copy history from STDIN CSV" < /tmp/FTSE.csv

-- 
D'Arcy J.M. Cain <darcy@druid.net>         |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.


pgsql-sql by date:

Previous
From: T E Schmitz
Date:
Subject: import CSV file
Next
From: Alvaro Herrera
Date:
Subject: Re: import CSV file