Re: copy- what's my root directory? - Mailing list pgsql-novice

From Carlo Ascani
Subject Re: copy- what's my root directory?
Date
Msg-id 20110908094601.7ee3d81e@2ndquadrant.it
Whole thread Raw
In response to copy- what's my root directory?  (Eric Hulburd <ehulburd@gmail.com>)
List pgsql-novice
On Wed, 7 Sep 2011 14:36:51 -0700
Eric Hulburd <ehulburd@gmail.com> wrote:

> Hi,
> I've got another newbie question.  I want to copy some csv data into
> my postgresql database.  I'm confused with the syntax though.  I
> entered
>
> mydb=# copy mytable from '/data.csv';
>
> It tells me it can't find data.csv, which means I saved it in the
> wrong place.  I've tried the data and scripts folder.  Where do I save
> import/export files and where is all my database work being saved?

Filename in COPY command is the absolute path.
Remember also to specify csv as FORMAT for the copy.

Manual page about copy can help you a lot.
For PostgreSQL 9.0, here it is:
http://www.postgresql.org/docs/9.0/static/sql-copy.html

Cheers,

--
 Carlo Ascani - 2ndQuadrant Italia
 PostgreSQL Training, Services and Support
 carlo.ascani@2ndQuadrant.it - www.2ndQuadrant.it

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: C Set Returning Function (SRF)
Next
From: Gary Chambers
Date:
Subject: Re: C Set Returning Function (SRF)