Re: import CSV file

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: T E Schmitz <mailreg(at)numerixtechnology(dot)de>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: import CSV file
Date: 2007-03-13 22:27:33
Message-ID: 20070313222733.GE3285@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message D'Arcy J.M. Cain 2007-03-13 22:27:40 Re: import CSV file
Previous Message Tom Lane 2007-03-13 21:30:40 Re: postgres configuration