Thread: .psql_history": No such file

.psql_history": No such file

From
ivan marchesini
Date:
Dear users,

I have installed a postgres db using a datadir different
from /var/lib/pgsql/.psql_history.

then:  su postgres  psql postgres

All went fine but when I exit from psql from a db I obtain:
_______
could not save history to file "/var/lib/pgsql/.psql_history": No such 
file or directory
_______

how can I fix this problem? where can I say psql that it must
write .psql_history into the datadir?

many thanks...
ivan






Re: .psql_history": No such file

From
Tom Lane
Date:
ivan marchesini <marchesini@unipg.it> writes:
> I have installed a postgres db using a datadir different
> from /var/lib/pgsql/.psql_history.

> then:
>    su postgres
>    psql postgres

> All went fine but when I exit from psql from a db I obtain:
> _______
> could not save history to file "/var/lib/pgsql/.psql_history": No such 
> file or directory
> _______

Apparently the postgres account still has HOME set to /var/lib/pgsql.
You'll want to make that point to some directory that actually exists.
        regards, tom lane


Re: .psql_history": No such file

From
Guillaume Lelarge
Date:
Hi Ivan,

Le vendredi 26 juin 2009 à 17:53:15, ivan marchesini a écrit :
> [...]
> I have installed a postgres db using a datadir different
> from /var/lib/pgsql/.psql_history.
>
> then:
>    su postgres
>    psql postgres
>
> All went fine but when I exit from psql from a db I obtain:
> _______
> could not save history to file "/var/lib/pgsql/.psql_history": No such
> file or directory
> _______
>
> how can I fix this problem? where can I say psql that it must
> write .psql_history into the datadir?
>

psql tries to write there because the home directory of the postgres user is
/var/lib/postgres. Probably better to use HISTFILE to change it (\set HISTFILE
'/path/to/histfile').

Regards.


--
Guillaume.http://www.postgresqlfr.orghttp://dalibo.com


Re: .psql_history": No such file

From
Shane Ambler
Date:
Guillaume Lelarge wrote:
> Hi Ivan,
> 
> Le vendredi 26 juin 2009 à 17:53:15, ivan marchesini a écrit :
>> [...]
>> I have installed a postgres db using a datadir different
>> from /var/lib/pgsql/.psql_history.
>>
>> then:
>>    su postgres
>>    psql postgres
>>
>> All went fine but when I exit from psql from a db I obtain:
>> _______
>> could not save history to file "/var/lib/pgsql/.psql_history": No such
>> file or directory
>> _______
>>
>> how can I fix this problem? where can I say psql that it must
>> write .psql_history into the datadir?
>>
> 
> psql tries to write there because the home directory of the postgres user is 
> /var/lib/postgres. Probably better to use HISTFILE to change it (\set HISTFILE 
> '/path/to/histfile').
> 
> Regards.
> 
> 
You do know that you don't need to su postgres to start psql?

Only the server needs to be run with the postgres user account. If you 
run psql from your normal user account the history file will be saved 
into your home folder not the postgresql install/data file dir.


-- 

Shane Ambler
pgSQL (at) Sheeky (dot) Biz



Re: .psql_history": No such file

From
ivan marchesini
Date:
Thanks to all...
in effect it is a very little problem if you consider that probably I
will call psql from normal accounts...

:-)

thanks


Il giorno dom, 28/06/2009 alle 01.04 +0930, Shane Ambler ha scritto:
> Guillaume Lelarge wrote:
> > Hi Ivan,
> > 
> > Le vendredi 26 juin 2009 à 17:53:15, ivan marchesini a écrit :
> >> [...]
> >> I have installed a postgres db using a datadir different
> >> from /var/lib/pgsql/.psql_history.
> >>
> >> then:
> >>    su postgres
> >>    psql postgres
> >>
> >> All went fine but when I exit from psql from a db I obtain:
> >> _______
> >> could not save history to file "/var/lib/pgsql/.psql_history": No such
> >> file or directory
> >> _______
> >>
> >> how can I fix this problem? where can I say psql that it must
> >> write .psql_history into the datadir?
> >>
> > 
> > psql tries to write there because the home directory of the postgres user is 
> > /var/lib/postgres. Probably better to use HISTFILE to change it (\set HISTFILE 
> > '/path/to/histfile').
> > 
> > Regards.
> > 
> > 
> You do know that you don't need to su postgres to start psql?
> 
> Only the server needs to be run with the postgres user account. If you 
> run psql from your normal user account the history file will be saved 
> into your home folder not the postgresql install/data file dir.
> 
> 
> -- 
> 
> Shane Ambler
> pgSQL (at) Sheeky (dot) Biz
> 
>