postgres.git / summary / log / commit / refs

commit    8d645a116ef6e04bfb03e259149b8e163dbdf50c
Author:   Alvaro Herrera <alvherre@alvh.no-ip.org>
Date:     Mon Mar 29 21:34:39 2021 +0000
First released in: 14.0, 13.3

    psql: call clearerr() just before printing
    
    We were never doing clearerr() on the output stream, which results in a
    message being printed after each result once an EOF is seen:
    
    could not print result table: Success
    
    This message was added by commit b03436994bcc (in the pg13 era); before
    that, the error indicator would never be examined.  So backpatch only
    that far back, even though the actual bug (to wit: the fact that the
    error indicator is never cleared) is older.


src/fe_utils/print.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/fe_utils/print.c b/src/fe_utils/print.c index e8772a278c3..273b1bfe4a4 100644 --- a/src/fe_utils/print.c +++ b/src/fe_utils/print.c @@ -3331,6 +3331,9 @@ printTable(const printTableContent *cont, is_local_pager = is_pager; } + /* clear any pre-existing error indication on the output stream */ + clearerr(fout); + /* print the stuff */ if (flog) [parent: af527705edc3]