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

Поиск
Список
Период
Сортировка
От Allan Kamau
Тема Piping CSV data to psql when executing COPY .. FROM STDIN
Дата
Msg-id 4906F68C.90502@sanbi.ac.za
обсуждение исходный текст
Ответы Re: Piping CSV data to psql when executing COPY .. FROM STDIN  (Sam Mason <sam@samason.me.uk>)
Список 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 по дате отправления:

Предыдущее
От: Raymond O'Donnell
Дата:
Сообщение: Re: Replication with slony-I
Следующее
От: Brent Austin
Дата:
Сообщение: [Help] Config Failure on Mac OSX: psqlodbc-08.03.0300