Re: psql lacking clearerr()

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: alvherre(at)alvh(dot)no-ip(dot)org
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: psql lacking clearerr()
Date: 2021-03-25 06:31:10
Message-ID: 20210325.153110.1482787543470546391.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At Wed, 24 Mar 2021 11:11:41 -0300, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2021-03-25 06:40:34 Re: [CLOBBER_CACHE]Server crashed with segfault 11 while executing clusterdb
Previous Message Masahiko Sawada 2021-03-25 06:05:51 Re: Replication slot stats misgivings