Re: [GENERAL] Archiving data to another server using copy, psql with pipe

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: [GENERAL] Archiving data to another server using copy, psql with pipe
Дата
Msg-id CAKFQuwZ3WX6wXn9n3x2GH6L7GvkxqDWH4zqMWz25cDdGvV6zNg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [GENERAL] Archiving data to another server using copy, psql withpipe  (Moreno Andreo <moreno.andreo@evolu-s.it>)
Список pgsql-general
On Thu, Apr 6, 2017 at 4:24 AM, Moreno Andreo <moreno.andreo@evolu-s.it> wrote:
psql -h localhost postgres -c "copy (SELECT * FROM a WHERE time < now()) to
stdout " | psql -h localhost  postgres   -c "copy b from stdin"

​The first question at hand is whether the source psql command will provoke an EOF (which is the only thing that will stop the copy-from) even though the complete contents of the copy-to have not yet been sent.

​The second question is whether, even if it does send EOF, the second command will be allowed to see that EOF and complete its command.  Pipeline failure mode might impact this (from bash experience).

Unfortunately I do not know the answers to those questions.

The source code might be of some help on the first.

Another option is to replace the first psql process with custom program that will send data to stdout and in the middle of doing so die with a non-zero exit code.​  That should be a workable simulation of the copy to command and evaluation of the target can be done to see what behavior is exhibitied.

David J.

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

Предыдущее
От: Magnus Hagander
Дата:
Сообщение: Re: [GENERAL] A change in the Debian install
Следующее
От: Tom DalPozzo
Дата:
Сообщение: Re: [GENERAL] WAL being written during SELECT * query