ERROR: relative path not allowed for COPY to file

Started by Andrew Taylorabout 13 years ago3 messagesgeneral
Jump to latest
#1Andrew Taylor
andydtaylor@gmail.com

Hi,

I must be being thick - can anyone tell me what I'm doing wrong?

postgres=# COPY post_e_n
postgres-# TO 'usr/local/psql/csv/post_e_n.csv'
postgres-# WITH DELIMITER ','
postgres-# CSV HEADER;
ERROR: relative path not allowed for COPY to file

COPY (SELECT * FROM post_e_n) gave me the same error.

I did chmod 755 -R psql to make sure the directory could be written to. Is
this to do with the underscores? There is no csv file pre-existing in the
directory.

Thanks,

Andy

#2Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Andrew Taylor (#1)
Re: ERROR: relative path not allowed for COPY to file

On 02/12/2013 09:19 AM, Andrew Taylor wrote:

Hi,

I must be being thick - can anyone tell me what I'm doing wrong?

postgres=# COPY post_e_n
postgres-# TO 'usr/local/psql/csv/post_e_n.csv'
postgres-# WITH DELIMITER ','
postgres-# CSV HEADER;
ERROR: relative path not allowed for COPY to file

COPY (SELECT * FROM post_e_n) gave me the same error.

I did chmod 755 -R psql to make sure the directory could be written to.
Is this to do with the underscores? There is no csv file pre-existing in
the directory.

'usr/local/psql/csv/post_e_n.csv'

should be

'/usr/local/psql/csv/post_e_n.csv'

Thanks,

Andy

--
Adrian Klaver
adrian.klaver@gmail.com

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#3Kevin Grittner
Kevin.Grittner@wicourts.gov
In reply to: Andrew Taylor (#1)
Re: ERROR: relative path not allowed for COPY to file

Andrew Taylor <andydtaylor@gmail.com> wrote:

postgres=# COPY post_e_n

postgres-# TO 'usr/local/psql/csv/post_e_n.csv'
postgres-# WITH DELIMITER ','
postgres-# CSV HEADER;
ERROR:  relative path not allowed for COPY to file

I think you need a slash at the front of that path.

-Kevin

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general