Skip site navigation (1) Skip section navigation (2)

Re: COPY command syntax error

From: gabrielle <gorthx(at)gmail(dot)com>
To: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
Cc: pdxpug(at)postgresql(dot)org
Subject: Re: COPY command syntax error
Date: 2011-02-02 19:31:07
Message-ID: AANLkTik2o89K4AbwcA5MZfACJjnbavC_SJhm3kEXWww2@mail.gmail.com (view raw or flat)
Thread:
Lists: pdxpug
On Wed, Feb 2, 2011 at 11:19 AM, Rich Shepard <rshepard(at)appl-ecosys(dot)com> wrote:
>  I'm trying to import data from a .csv file into an existing table. It
> worked the first time I loaded data into this table.
>
>  I'm invoking psql from the same directory as the import.csv file. The
> command I'm using,
> and the results are:
>
> jerrittwq=# copy monitor from
> '/home/rshepard/projects/queenstake/permitwatch/water-quality-info/csv_versions/import.csv'
> with delimiter as ':' csv;
> ERROR:  could not open file
> "/home/rshepard/projects/queenstake/permitwatch/water-quality-info/csv_versions/import.csv"
> for reading: No such file or directory
>
>  Doesn't matter how I specify the file's location (full path or cwd). Do I
> also need to specify the text delimeters with quote as '''? (The command
> line does not like my using double quotes to delimit the single quote.)
>
>  What do I have syntactically wrong here?

That syntax (COPY table FROM '/path/to/file' WITH DELIMITER AS ':'
CSV;) works for me in a similar test.

Are you sure the file exists?  Try taking off the "with ... csv" piece
and see if you get the same error.

gabrielle

In response to

Responses

pdxpug by date

Next:From: Rich ShepardDate: 2011-02-02 19:31:41
Subject: Re: COPY command syntax error
Previous:From: Rich ShepardDate: 2011-02-02 19:28:11
Subject: Re: COPY command syntax error

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group