Home > Archive > PostgreSQL Administration > September 2005 > COPY TO / COPY FROM









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author COPY TO / COPY FROM
Cédric Buschini

2005-09-23, 7:23 am

Hi

Here I am again with my 'stupd' question

here is a script :

====================
=
psql -h192.168.XXX.XXX -dDATABASE -Upostgres << EOF > /home/postgres/FILE
COPY TABLE TO stdout;
EOF

psql -h192.168.XXX.XXX -dDATABASE -Upostgres << EOF
COPY carax_exec_bck FROM '/home/postgres/FILE';
EOF
====================
===

I got this error :
ERROR: could not open file "/home/postgres/FILE" for reading: No such
file or directory

????

thx

cedric

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Aldor

2005-09-23, 7:23 am

Why you don't make:

COPY carax_exec_bck TO '/home/postgres/FILE';

?

Then you could also use something like....

COPY carax_exec_bck TO '/home/postgres/FILE' WITH BINARY;

etc.

Cédric Buschini wrote:
> Hi
>
> Here I am again with my 'stupd' question
>
> here is a script :
>
> ====================
=
> psql -h192.168.XXX.XXX -dDATABASE -Upostgres << EOF > /home/postgres/FILE
> COPY TABLE TO stdout;
> EOF
>
> psql -h192.168.XXX.XXX -dDATABASE -Upostgres << EOF
> COPY carax_exec_bck FROM '/home/postgres/FILE';
> EOF
> ====================
===
>
> I got this error :
> ERROR: could not open file "/home/postgres/FILE" for reading: No such
> file or directory
>
> ????
>
> thx
>
> cedric
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
>


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Michael Fuhr

2005-09-23, 9:23 am

On Fri, Sep 23, 2005 at 01:48:33PM +0200, Cédric Buschini wrote:
> ====================
=
> psql -h192.168.XXX.XXX -dDATABASE -Upostgres << EOF > /home/postgres/FILE
> COPY TABLE TO stdout;
> EOF
>
> psql -h192.168.XXX.XXX -dDATABASE -Upostgres << EOF
> COPY carax_exec_bck FROM '/home/postgres/FILE';
> EOF
> ====================
===
>
> I got this error :
> ERROR: could not open file "/home/postgres/FILE" for reading: No such
> file or directory


Are the client and server on the same machine? The use of the -h
option suggests perhaps not. In the first command you're redirecting
psql's output to a file on the client machine, and in the second
command you're trying to read a file on the server machine.

--
Michael Fuhr

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com