Обсуждение: copy- what's my root directory?
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?
Thanks.
Eric
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