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: (view raw, whole thread or download thread mbox)
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.


In response to


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-2017 The PostgreSQL Global Development Group