\COPY in script

Поиск
Список
Период
Сортировка
От Binand Sethumadhavan
Тема \COPY in script
Дата
Msg-id CAFBJCCZVUgsQsKrjHA8Lr+-990WJqXV265j5P3XE9cJmio-0gg@mail.gmail.com
обсуждение исходный текст
Ответы Re: \COPY in script  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-novice
I am trying to do a summary query in one DB, and populate a table in another.

This is how I'm doing it:

psql -h db1 -d d1 -U u1 -A -F, -t -f a.sql | psql -h db2 -d d2 -U u2 [...]

Now, this ellipsis is what is causing consternation.

1. If the ellipsis is -c "$( < b.sql )" my target table gets populated.
2. If the ellipsis is -f b.sql my target table does not get populated.

My b.sql is as follows:

\COPY table_name FROM STDIN CSV

That's it. Why does (1) work but (2) does not? To the purist in me,
(2) is the preferred syntax so what should I do to ensure that it
works?

TIA,

Binand


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

Предыдущее
От: Andreas Kretschmer
Дата:
Сообщение: Re: Help on using hyperloglog in Postgresql
Следующее
От: Tom Lane
Дата:
Сообщение: Re: \COPY in script