Re: Alternative to \copy in psql modelled after \g

Поиск
Список
Период
Сортировка
Искать
От
Daniel Verite
Тема
Re: Alternative to \copy in psql modelled after \g
Дата
Msg-id
881c25d2-0a15-4e50-a175-738056146973@manitou-mail.org
Ответ на
Список
Дерево обсуждения
Alternative to \copy in psql modelled after \g "Daniel Verite" <daniel@manitou-mail.org>
Re: Alternative to \copy in psql modelled after \g "David G. Johnston" <david.g.johnston@gmail.com>
Re: Alternative to \copy in psql modelled after \g "Daniel Verite" <daniel@manitou-mail.org>
Re: Alternative to \copy in psql modelled after \g "David G. Johnston" <david.g.johnston@gmail.com>
Re: Alternative to \copy in psql modelled after \g "Daniel Verite" <daniel@manitou-mail.org>
Re: Alternative to \copy in psql modelled after \g "Daniel Verite" <daniel@manitou-mail.org>
Re: Alternative to \copy in psql modelled after \g Tom Lane <tgl@sss.pgh.pa.us>
Re: Alternative to \copy in psql modelled after \g Fabien COELHO <coelho@cri.ensmp.fr>
Re: Alternative to \copy in psql modelled after \g "Daniel Verite" <daniel@manitou-mail.org>
Re: Alternative to \copy in psql modelled after \g Fabien COELHO <coelho@cri.ensmp.fr>
Re: Alternative to \copy in psql modelled after \g "Daniel Verite" <daniel@manitou-mail.org>
Re: Alternative to \copy in psql modelled after \g Fabien COELHO <coelho@cri.ensmp.fr>
Re: Alternative to \copy in psql modelled after \g "Daniel Verite" <daniel@manitou-mail.org>
Re: Alternative to \copy in psql modelled after \g Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Alternative to \copy in psql modelled after \g Tom Lane <tgl@sss.pgh.pa.us>
Re: Alternative to \copy in psql modelled after \g "Daniel Verite" <daniel@manitou-mail.org>
Re: Alternative to \copy in psql modelled after \g Fabien COELHO <coelho@cri.ensmp.fr>
Re: Alternative to \copy in psql modelled after \g "Daniel Verite" <daniel@manitou-mail.org>
Re: Alternative to \copy in psql modelled after \g Fabien COELHO <coelho@cri.ensmp.fr>
Re: Alternative to \copy in psql modelled after \g "Daniel Verite" <daniel@manitou-mail.org>
Re: Alternative to \copy in psql modelled after \g Fabien COELHO <coelho@cri.ensmp.fr>
Re: Alternative to \copy in psql modelled after \g "Daniel Verite" <daniel@manitou-mail.org>
Re: Alternative to \copy in psql modelled after \g Fabien COELHO <coelho@cri.ensmp.fr>
Re: Alternative to \copy in psql modelled after \g "Daniel Verite" <daniel@manitou-mail.org>
Re: Alternative to \copy in psql modelled after \g Fabien COELHO <coelho@cri.ensmp.fr>
Re: Alternative to \copy in psql modelled after \g Tom Lane <tgl@sss.pgh.pa.us>
Re: Alternative to \copy in psql modelled after \g Fabien COELHO <coelho@cri.ensmp.fr>
Re: Alternative to \copy in psql modelled after \g Tom Lane <tgl@sss.pgh.pa.us>
Re: Alternative to \copy in psql modelled after \g "Daniel Verite" <daniel@manitou-mail.org>
Re: Alternative to \copy in psql modelled after \g Tom Lane <tgl@sss.pgh.pa.us>
Re: Alternative to \copy in psql modelled after \g "Daniel Verite" <daniel@manitou-mail.org>
Re: Alternative to \copy in psql modelled after \g Corey Huinker <corey.huinker@gmail.com>
Re: Alternative to \copy in psql modelled after \g "Daniel Verite" <daniel@manitou-mail.org>
Re: Alternative to \copy in psql modelled after \g Tom Lane <tgl@sss.pgh.pa.us>
Re: Alternative to \copy in psql modelled after \g Fabien COELHO <coelho@cri.ensmp.fr>
Re: Alternative to \copy in psql modelled after \g "Daniel Verite" <daniel@manitou-mail.org>
	I wrote:

> I admit that if we could improve \g to handle COPY, it would be more
> elegant than the current proposal adding two meta-commands.
> 
> But the copy-workflow and non-copy-workflow are different, and in
> order to know which one to start, \g would need to analyze the query

It turns out I was wrong on this. The workflows are different but when
psql receives the first PGresult, it's still time to handle the I/O
redirection. It just differs from \copy in the case of an error:
\copy won't even send a command to the server if the local output
stream can't be opened, whereas COPY \g would send the command, and
will have to deal with the client-side error afterwards.

Well, except that up to now, COPY ... TO STDOUT \g file or \g |command
has been ignoring "file" or "|command", which is arguably a bug as Tom
puts it in another discussion in [1].

So as a replacement for the \copyto I was proposing earlier, PFA a patch
for COPY TO STDOUT to make use of the argument to \g.


[1] bug #15535
https://www.postgresql.org/message-id/6309.1544031175@sss.pgh.pa.us


Best regards,
-- 
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite
В списке pgsql-hackers по дате отправления
От: Tomas Vondra
Дата:
От: Alvaro Herrera
Дата:
FAQ