Piping CSV data to psql when executing COPY .. FROM STDIN - Mailing list pgsql-general

From Allan Kamau
Subject Piping CSV data to psql when executing COPY .. FROM STDIN
Date
Msg-id 4906F68C.90502@sanbi.ac.za
Whole thread Raw
Responses Re: Piping CSV data to psql when executing COPY .. FROM STDIN  (Sam Mason <sam@samason.me.uk>)
List 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.


pgsql-general by date:

Previous
From: Raymond O'Donnell
Date:
Subject: Re: Replication with slony-I
Next
From: Brent Austin
Date:
Subject: [Help] Config Failure on Mac OSX: psqlodbc-08.03.0300