Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 6, 2017 at 4:24 AM, Moreno Andreo <moreno.andreo@xxxxxxxxxx> 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.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux