Re: psql -e

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: psql -e
Дата
Msg-id 200307310423.h6V4NwS26257@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: psql -e  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
I assume this is the fflush you mentioned.  Patch attached and applied.

---------------------------------------------------------------------------

Tom Lane wrote:
> Peter Eisentraut <peter_e@gmx.net> writes:
> > Rajesh Kumar Mallah writes:
> >> The echo feature of psql echos the query after its executed.
> >> does it makes more sense to have the reverse.
>
> > The query is printed *before* it is executed, but you might not see it
> > because your terminal is not flushing the stdout at the right times.
>
> It might be a good idea to do an explicit fflush(stdout) right after
> printing the query.  I observe that PSQLexec() does this, and SendQuery
> does too in one path --- but not in the other.
>
>             regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/bin/psql/common.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/psql/common.c,v
retrieving revision 1.66
diff -c -c -r1.66 common.c
*** src/bin/psql/common.c    23 Jul 2003 08:47:39 -0000    1.66
--- src/bin/psql/common.c    31 Jul 2003 04:21:53 -0000
***************
*** 595,602 ****
                  return false;
      }
      else if (VariableEquals(pset.vars, "ECHO", "queries"))
          puts(query);
!
      SetCancelConn();

      if (PQtransactionStatus(pset.db) == PQTRANS_IDLE &&
--- 595,605 ----
                  return false;
      }
      else if (VariableEquals(pset.vars, "ECHO", "queries"))
+     {
          puts(query);
!         fflush(stdout);
!     }
!
      SetCancelConn();

      if (PQtransactionStatus(pset.db) == PQTRANS_IDLE &&

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: hexadecimal to decimal
Следующее
От: Joe Conway
Дата:
Сообщение: Re: hexadecimal to decimal