Re: copy- what's my root directory?

From: Carlo Ascani <carlo(dot)ascani(at)2ndquadrant(dot)it>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: copy- what's my root directory?
Date: 2011-09-08 07:46:01
Message-ID: 20110908094601.7ee3d81e@2ndquadrant.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Wed, 7 Sep 2011 14:36:51 -0700
Eric Hulburd <ehulburd(at)gmail(dot)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(dot)ascani(at)2ndQuadrant(dot)it - www.2ndQuadrant.it

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Gary Chambers 2011-09-08 18:27:54 Re: C Set Returning Function (SRF)
Previous Message Tom Lane 2011-09-08 05:31:44 Re: C Set Returning Function (SRF)