From: | "PostgreSQL Bugs List" <pgsql-bugs(at)postgresql(dot)org> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | BUG #1057: psql sometimes does not flush its output |
Date: | 2004-01-20 22:52:08 |
Message-ID: | 20040120225208.B0D1ECF4BF4@www.postgresql.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged online:
Bug reference: 1057
Logged by: Jon Sablatnig
Email address: jhs(at)cs(dot)tu-berlin(dot)de
PostgreSQL version: 7.4
Operating system: Linux 2.4
Description: psql sometimes does not flush its output
Details:
The frontend psql will usually flush its output after
every command.
Since version 7.4, it will NOT flush after its FIRST
command, if the output is NOT a tty.
Testcase:
$ psql template1 | more
Now type:
\qecho hello
The text will NOT appear.
Try it again, both lines will appear.
This is rather annoying when trying to parse the output
automatically, so please revert to the old behaviour of
always flushing.
Analysis & fix:
The relevant files are
postgresql-7.4.1/src/bin/psql/mainloop.c
, and the same file in postgresql-7.3.4.
Specifically, the else{} block from line 161 on (both
files) changed so that the fflush(stdout) moved inside
the if (pset.cur_cmd_interactive). Undoing this change
will fix the bug.
Another, perhaps slightly cleaner option is to add the
line
fflush(pset.queryFout);
just before the end of the main while loop (line 499
in 7.4). This also fixes the bug.
Laters,
jon
From | Date | Subject | |
---|---|---|---|
Next Message | bs | 2004-01-21 09:51:13 | 7.4.xx regression |
Previous Message | Scott Yeadon | 2004-01-20 22:37:55 | connection handling in 7.4.1 |