Re: psql: customizable readline history filename

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Andreas Seltenreich <seltenreich(at)gmx(dot)de>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: psql: customizable readline history filename
Date: 2005-06-10 16:28:52
Message-ID: 200506101628.j5AGSqt09706@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Andreas Seltenreich wrote:
> Bruce Momjian schrob:
>
> > I noticed your documentation example had a space before :DBNAME --- I
> > removed the space.
>
> This space is necessary for proper expansion of the parameter. The
> \set-Command concatenates all its arguments after expansion:
>
> --8<---------------cut here---------------start------------->8---
> scratch=# \set HISTFILE .psql_history-:DBNAME
> scratch=# \echo :HISTFILE
> .psql_history-:DBNAME
> scratch=# \set HISTFILE .psql_history- :DBNAME
> scratch=# \echo :HISTFILE
> .psql_history-scratch
> scratch=#
> --8<---------------cut here---------------end--------------->8---
>
> > You had the idea of not saving the history on exit if HISTFILE is not
> > set. I don't think we have community agreement on that change, and I
> > bet we wouldn't get it. (I have removed your documentation mention of
> > this.) I think setting HISTSIZE to zero has that effect already if
> > people want it.
>
> I went for bash's behaviour back then, since we copied bash's
> semantics with the other history options too.

Ah, I see. I tested ':' expansion in queries and found the space wasn't
needed, but I see now that with \set it is needed:

test=> \set x a
test=> \echo :x
a
test=> \set y b:x
test=> \echo :y
b:x
test=> \set y b :x
test=> \echo :y
ba

I will update the documentation to add the space. Thanks.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Tatsuo Ishii 2005-06-10 16:33:35 Re: bugfix: character-code conversion of MIC -> EUC_JP.
Previous Message Neil Conway 2005-06-10 16:23:32 Re: final light versions of Oracle compatibility (SQLSTATE,