The following bug has been logged on the website:
Bug reference: 15541
Logged by: Pan Bian
Email address: bianpan2016@163.com
PostgreSQL version: 11.1
Operating system: Linux
Description:
File: src/interfaces/libpq/fe-print.c
Function: PQprint
Issue details:
The function PQprint releases the file hander fout via pclose or _pclose
when usePipe is true. After that, fout is used again to write message
"fputs("</table>\n", fout);".
For your convenience, I copy-and-paste related code as follows.
67 void
68 PQprint(FILE *fout, const PGresult *res, const PQprintOpt *po)
69 {
...
310 if (usePipe)
311 {
312 #ifdef WIN32
313 _pclose(fout);
314 #else
315 pclose(fout);
316
317 #ifdef ENABLE_THREAD_SAFETY
318 /* we can't easily verify if EPIPE occurred, so say it did
*/
319 if (sigpipe_masked)
320 pq_reset_sigpipe(&osigset, sigpipe_pending, true);
321 #else
322 pqsignal(SIGPIPE, oldsigpipehandler);
323 #endif /* ENABLE_THREAD_SAFETY */
324 #endif /* WIN32 */
325 }
326 if (po->html3 && !po->expanded)
327 fputs("</table>\n", fout);
328 }
329 }
Thank you,
Pan Bian