Re: [PERFORM] psql -A (unaligned format) eats too much - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PERFORM] psql -A (unaligned format) eats too much
Date
Msg-id 17223.1149605250@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PERFORM] psql -A (unaligned format) eats too much  ("Jim C. Nasby" <jnasby@pervasive.com>)
List pgsql-hackers
"Jim C. Nasby" <jnasby@pervasive.com> writes:
> On Tue, Jun 06, 2006 at 09:48:43AM -0400, Tom Lane wrote:
>>> psql --cursor -c "select ..." | myprogram
>>> there would be no very good way for myprogram to find out that it'd
>>> been sent an incomplete result due to error partway through the SELECT.

> So if an error occurs partway through reading a cursor, no error message
> is generated? That certainly sounds like a bug to me...

Sure an error is generated.  But it goes to stderr.  The guy at the
downstream end of the stdout pipe cannot see either the error message,
or the nonzero status that psql will (hopefully) exit with.

You can theoretically deal with this by having the shell script calling
this combination check psql exit status and discard the results of
myprogram on failure, but it's not easy or simple.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Jim C. Nasby"
Date:
Subject: Re: [PERFORM] psql -A (unaligned format) eats too much
Next
From: Harald Fuchs
Date:
Subject: Re: COPY (query) TO file