Stephen Frost <sfrost@snowman.net> writes:
> * Tom Lane (tgl@sss.pgh.pa.us) wrote:
>> I thought it might be about that simple once you went at it the right
>> way ;-). However, I'd suggest checking ferror(pset.queryFout) as well
>> as the fflush result.
> Sure, I can add the ferror() check. Patch attached.
This seemed pretty small and uncontroversial, so I went ahead and
committed it for 9.0. I rearranged the order of operations a bit to
make it seem more coherent, and also added an initial clearerr() just
to forestall problems if stdout had the error flag set for some reason.
regards, tom lane