Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id D553E63340D for ; Sat, 27 Jun 2009 12:39:24 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 83004-10 for ; Sat, 27 Jun 2009 12:39:23 -0300 (ADT) X-Greylist: delayed 00:05:03.814169 by SQLgrey-1.7.6 Received: from ipmail01.adl6.internode.on.net (ipmail01.adl6.internode.on.net [203.16.214.146]) by mail.postgresql.org (Postfix) with ESMTP id 58E7863319A for ; Sat, 27 Jun 2009 12:39:23 -0300 (ADT) Received: from ppp247-71.static.internode.on.net (HELO DevBox.local) ([203.122.247.71]) by ipmail01.adl6.internode.on.net with ESMTP; 28 Jun 2009 01:04:15 +0930 Message-ID: <4A463C15.8010309@Sheeky.Biz> Date: Sun, 28 Jun 2009 01:04:45 +0930 From: Shane Ambler User-Agent: Thunderbird 2.0.0.21 (Macintosh/20090302) MIME-Version: 1.0 To: Guillaume Lelarge CC: pgsql-sql@postgresql.org, marchesini@unipg.it Subject: Re: .psql_history": No such file References: <1246031595.4836.27.camel@ivangeo> <200906261814.59148.guillaume@lelarge.info> In-Reply-To: <200906261814.59148.guillaume@lelarge.info> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200906/111 X-Sequence-Number: 32716 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