COPY to STDOUT and pipes

Поиск
Список
Период
Сортировка
От kevin kempter
Тема COPY to STDOUT and pipes
Дата
Msg-id 51F6AC00-1668-41A5-97EA-EB8D1D53525A@kevinkempterllc.com
обсуждение исходный текст
Ответы Re: COPY to STDOUT and pipes
Re: COPY to STDOUT and pipes
Список pgsql-general
Hi List;


I want to run a copy (based on a select) to STDOUT and pipe it to a
psql copy from STDIN on a different host.

here's what I have:

1) a .sql file that looks like this:

copy (
select
   cust_id,
   cust_name,
   last_update_dt
from sl_cust
)
to STDOUT
with delimiter '|'


This works.

However I want to pipe the resulting data into a psql statement that
does a copy IN to a table on another host. I can't seem to get it
right. I tried this:

psql -f file1.sql | psql -h newhost -f file2.sql

where file1.sql is the copy statement above and file2.sql does a copy
table from STDIN with delimiter '|'

Any thoughts on what I'm doing wrong?

Thanks in advance...

/Kevin

В списке pgsql-general по дате отправления:

Предыдущее
От: "Chris Velevitch"
Дата:
Сообщение: Re: how to get pg_restore to continue if an error occurs
Следующее
От: Craig Ringer
Дата:
Сообщение: Re: COPY to STDOUT and pipes