From: Tom Lane <tgl@sss.pgh.pa.us>
To: luis.carril@swarm64.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15554: Broken pipe when doing a COPY of a parallel query
Date: Mon, 17 Dec 2018 09:50:16 -0500
Message-ID: <28346.1545058216@sss.pgh.pa.us> (raw)
In-Reply-To: <15554-04979fa61a082393@postgresql.org>
References: <15554-04979fa61a082393@postgresql.org>
=?utf-8?q?PG_Bug_reporting_form?= <noreply@postgresql.org> writes:
> when performing a COPY TO operation with the result of a parallel query a
> 'Broken Pipe' error is returned
> ...
> set force_parallel_mode to on;
> copy ( select 1) to program 'ls'; -- this SELECT also has a gather node
> ERROR: could not close pipe to external command: Broken pipe
I'm not convinced that this is a bug. The external program did not
read the data we sent it, and it seems appropriate to report that.
> Note that there is no broken pipe if there is no Gather node:
> set force_parallel_mode to on;
> copy ( select 1) to program 'ls';
> COPY 1
(I think you meant "off" not "on" there.) This is just a question of
timing: the parallel copy takes long enough to start up that the "ls"
has already done its thing and exited, so that we see EPIPE, while
the non-parallel case doesn't see the error. Ideally we'd report an
error in both cases, but the kernel doesn't make it possible to do
that :-(.
With a larger chunk of COPY data, the error is reported a bit sooner,
with different text:
regression=# copy ( select u from a) to program 'ls';
ERROR: could not write to COPY program: Broken pipe
regression=# copy ( select sum(u) from a) to program 'ls';
ERROR: could not close pipe to external command: Broken pipe
Perhaps it's worth adding an fflush at the end, and reporting any
error from the fflush using "could not write to COPY program".
But that seems cosmetic.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, luis.carril@swarm64.com
Subject: Re: BUG #15554: Broken pipe when doing a COPY of a parallel query
In-Reply-To: <28346.1545058216@sss.pgh.pa.us>
References: <15554-04979fa61a082393@postgresql.org> <28346.1545058216@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox