Re: psql lacking clearerr() - Mailing list pgsql-hackers

From Kyotaro Horiguchi
Subject Re: psql lacking clearerr()
Date
Msg-id 20210325.153110.1482787543470546391.horikyota.ntt@gmail.com
Whole thread Raw
In response to psql lacking clearerr()  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Responses Re: psql lacking clearerr()
List pgsql-hackers
At Wed, 24 Mar 2021 11:11:41 -0300, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote in 
> psql seems to never call clearerr() on its output file.  So if it gets
> an error while printing a result, it'll show
> 
> could not print result table: Success
> 
> after each and every result, even though the output file isn't in error
> state anymore.
> 
> It seems that the simplest fix is just to do clearerr() at the start of
> printTable(), as in the attached.
> 
> I haven't been able to find a good reproducer.  Sometimes doing C-s C-c
> does it, but I'm not sure it is fully reproducible.

That worked for me:p  And the following steps always raises that error.

postgres=# select 1; (just to let it into history).
postgres=# C-s -> C-p -> C-m -> C-c
postgres=# select 1;
...
could not print result table: Success

And actually the patch works and the location looks like appropriate.

By the way, I think errno is not set when f* functions fail so anyway
isn't %m in the messages is useless?

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center



pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: Replication slot stats misgivings
Next
From: Kyotaro Horiguchi
Date:
Subject: Re: [CLOBBER_CACHE]Server crashed with segfault 11 while executing clusterdb