pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: T E Schmitz <mailreg@numerixtechnology.de>
To: pgsql-sql@postgresql.org
Subject: Re: import CSV file
Date: Tue, 13 Mar 2007 23:44:02 +0000
Message-ID: <45F73742.2080505@numerixtechnology.de> (raw)
In-Reply-To: <20070313182740.ef40e742.darcy@druid.net>
References: <45F70BC9.801@numerixtechnology.de>
	<20070313182740.ef40e742.darcy@druid.net>

D'Arcy J.M. Cain wrote:
> 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
> 

This is pretty ingenious!
Just a few minor problems:
- how does COPY know which column is which?
- how do I specify DELIMITER as TAB?



-- 


Regards/Gruß,

Tarlika Elisabeth Schmitz



view thread (11+ messages)  latest in thread

Message-ID: <45F73742.2080505@numerixtechnology.de>
Permalink:  ../45F73742.2080505@numerixtechnology.de/
Also on:    postgresql.org/message-id/45F73742.2080505@numerixtechnology.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mailreg@numerixtechnology.de
  Subject: Re: import CSV file
  In-Reply-To: <45F73742.2080505@numerixtechnology.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox