Re: Multiple psql history files - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Multiple psql history files
Date
Msg-id 23615.1476811298@sss.pgh.pa.us
Whole thread Raw
In response to Re: Multiple psql history files  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: Multiple psql history files  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-hackers
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Tue, Oct 18, 2016 at 9:45 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> One interesting point, if you wish to consider history as being
>> connection-specific, is what happens during a \c command.  Right
>> now the answer is "nothing" but you might wish it were different.

> ​Just to clarify/confirm a point inferred from the docs...
> If you place "\set HISTFILE​ ~/.psql_history- :DBNAME"
> ​into your .psqlrc file then when you perform a "\c" the .psqlrc file is
> re-read and the ​new value for DBNAME is used to generate a new history
> file name.

Um, no, I see no indication of that in the code.  Where did you read that
in the docs?

If we wanted the history file to change at \c, I think the best way would
be to invent some escape-patterns that could be placed in the value of
HISTFILE, say along the lines of "\set HISTFILE ~/.psql_history-%h-%p",
and then specify that if the value contains any such patterns we'll dump
and reload the history file when reconnecting.  But TBH I don't think
it's worth the trouble.  I'd sure like to have seen multiple requests
for such functionality before we go to the trouble.
        regards, tom lane



pgsql-hackers by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Multiple psql history files
Next
From: Robert Haas
Date:
Subject: Re: Hash Indexes