Re: BUG #5616: psql Doesn't Change Log files on \c

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #5616: psql Doesn't Change Log files on \c
Дата
Msg-id 7478.1281652393@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #5616: psql Doesn't Change Log files on \c  ("David E. Wheeler" <david@kineticode.com>)
Ответы Re: BUG #5616: psql Doesn't Change Log files on \c  (hubert depesz lubaczewski <depesz@depesz.com>)
Список pgsql-bugs
"David E. Wheeler" <david@kineticode.com> writes:
> I have this in my .psqlrc:
>     \set HISTFILE ~/.psql_history- :DBNAME
> This is great, except when I change databases in a session:

>     % psql foo
>     foo % \c bar
>     You are now connected to database "bar".
>     SELECT true;

> The last statement will be logged to ~/.psql_history-foo when it should go
> to ~/.psql_history-bar.

I don't think this is a bug.  The history file is read at psql startup
and written out (to the same file name) at exit.  Those operations are
quite expensive, so it would be insane to do them after every backslash
command on the off chance that somebody was expecting to have changed
the effective name of the history file.  (Aside from the cost, this
would greatly increase the race condition hazards from concurrent psql
sessions trying to write the file at the same time.)

            regards, tom lane

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

Предыдущее
От: "David E. Wheeler"
Дата:
Сообщение: BUG #5616: psql Doesn't Change Log files on \c
Следующее
От: Fujii Masao
Дата:
Сообщение: Re: Re: BUG #5602: Recovering from Hot-Standby file backup leads to the currupted indexes