Re: import CSV file - Mailing list pgsql-sql

From Alvaro Herrera
Subject Re: import CSV file
Date
Msg-id 20070313222733.GE3285@alvh.no-ip.org
Whole thread Raw
In response to import CSV file  (T E Schmitz <mailreg@numerixtechnology.de>)
List pgsql-sql
T E Schmitz 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?

Is the server on the same machine that's running psql?  If not, then
this fails because it tries to open the file server-side.  The suggested
workaround is to use psql's \copy.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


pgsql-sql by date:

Previous
From: "D'Arcy J.M. Cain"
Date:
Subject: Re: import CSV file
Next
From: Jure Kodzoman
Date:
Subject: Re: import CSV file