dbTalk Databases Forums  

[BUGS] BUG #1057: psql sometimes does not flush its output

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #1057: psql sometimes does not flush its output in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
PostgreSQL Bugs List
 
Posts: n/a

Default [BUGS] BUG #1057: psql sometimes does not flush its output - 01-20-2004 , 06:02 PM







The following bug has been logged online:

Bug reference: 1057
Logged by: Jon Sablatnig

Email address: jhs (AT) cs (DOT) tu-berlin.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



---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.