Search Postgresql Archives

Piping CSV data to psql when executing COPY .. FROM STDIN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,
I am trying to copy data (results of a SELECT * FROM abc WHERE ...) to a remote PC (on my network).

If I execute the "COPY abc2 FROM abc.txt CSV WITH HEADER" on psql connected to the remote PC, PostgreSQL will expect the file to be resident on the (remote) server's file system (or atleast accessible via it's file system). This would require me to configure password less scp for a given OS user account between the two PC. Then have a script send the csv file to the remote server before I call the COPY command. Am trying to avoid this step.

The alternative I am attempting is to use "COPY abc FROM STDIN WITH HEADER". I pipe the contents of the CSV file on my PC to the psql command (that connects to the remote PC) while issuing this copy command.
This does seems not to work.
Is there a way around it.


Allan.


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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux