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

From: Allan Kamau <allank(at)sanbi(dot)ac(dot)za>
To: pgsql-general(at)postgresql(dot)org
Subject: Piping CSV data to psql when executing COPY .. FROM STDIN
Date: 2008-10-28 11:25:00
Message-ID: 4906F68C.90502@sanbi.ac.za
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Brent Austin 2008-10-28 12:22:55 [Help] Config Failure on Mac OSX: psqlodbc-08.03.0300
Previous Message Raymond O'Donnell 2008-10-28 10:30:15 Re: Replication with slony-I