BUG #1057: psql sometimes does not flush its output

Поиск
Список
Период
Сортировка
От PostgreSQL Bugs List
Тема BUG #1057: psql sometimes does not flush its output
Дата
Msg-id 20040120225208.B0D1ECF4BF4@www.postgresql.com
обсуждение исходный текст
Список pgsql-bugs
The following bug has been logged online:

Bug reference:      1057
Logged by:          Jon Sablatnig

Email address:      jhs@cs.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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "PostgreSQL Bugs List"
Дата:
Сообщение: BUG #1056: ecpg ignores WHENEVER NOT FOUND
Следующее
От: Michael Meskes
Дата:
Сообщение: Re: BUG #1056: ecpg ignores WHENEVER NOT FOUND