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.
--
Álvaro Herrera Valdivia, Chile