"save history" problem

Started by David F. Johnsonalmost 20 years ago5 messagesgeneral
Jump to latest
#1David F. Johnson
dfjohnson@cabaret.com

Greetings.

Any ideas on how to resolve this problem:

==========

Welcome to psql 8.1.3, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit

test=# \q
could not save history to file "/usr/local/pgsql//.psql_history": Permission
denied

==========

Other installations of stable releases of 8.x.x did not have this problem,
though I'm just now running it under Mac OS X Tiger (10.4.6). I'm guessing
it's a Tiger issue but I don't know what to do about it.

That said, shouldn't

/usr/local/pgsql//.psql_history

be

/usr/local/pgsql/.psql_history

instead? I gave up trying to fix it using a .psqlrc file.

Thanks,
David

PS Thank you SO MUCH for such an absolutely incredible database!

#2Martijn van Oosterhout
kleptog@svana.org
In reply to: David F. Johnson (#1)
Re: "save history" problem

On Sun, Apr 23, 2006 at 09:33:40PM -0400, David F. Johnson wrote:

Greetings.

Any ideas on how to resolve this problem:

<snip>

test=# \q
could not save history to file "/usr/local/pgsql//.psql_history": Permission
denied

I don't know about the platform, but shouldn't that refer to your home
directory?

Other installations of stable releases of 8.x.x did not have this problem,
though I'm just now running it under Mac OS X Tiger (10.4.6). I'm guessing
it's a Tiger issue but I don't know what to do about it.

Something like: \set HISTFILE 'blah' should do it, check the docs.

That said, shouldn't
/usr/local/pgsql//.psql_history
be
/usr/local/pgsql/.psql_history

There's no difference (semantically) between the two...

Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/

Show quoted text

From each according to his ability. To each according to his ability to litigate.

#3Jerry LeVan
jerry.levan@eku.edu
In reply to: Martijn van Oosterhout (#2)
Re: "save history" problem

David,

It appears that the problem is related to the
fact that MacOSX does not really use the libreadline
(checks and you will see that it is a symlink to
libedit.)

I asked this question a year or so ago and Tom
Lane said that when the history file was closed
that the libedit did not return the right status
code.

I got rid of the error message by changing the source
to ignore the return code...

Currently I simply ignore the error message :) and
use tools that have reduced my usage of psql to
a bare minimum. ( http://homepage.mac.com/levanj )

Jerry

#4David F. Johnson
dfjohnson@cabaret.com
In reply to: Martijn van Oosterhout (#2)
Re: "save history" problem

Hi Martijn.

Thanks for the tip on there being no real difference in the two paths (i.e.,
I'm not a Unix guy).

Unfortunately, as I said in my original post, using the .psqlrc option to
set the HISTFILE to the user directory didn't work either.

After changing ownership of the /usr/local/pgsql/ to the postgres user, the
history file mechanism works (i.e., the history is saved in the
.psql_history file), but this message is reported:

could not save history to file "/usr/local/pgsql//.psql_history": Unknown
error: 0

There's no .psqlrc file so it's just using the default. Since the message
is benign I'll just ignore it (like Jerry Levan does :)

Thanks,
David

On 4/24/06 1:59 PM, "Martijn van Oosterhout" <kleptog@svana.org> wrote:

Show quoted text

On Sun, Apr 23, 2006 at 09:33:40PM -0400, David F. Johnson wrote:

Greetings.

Any ideas on how to resolve this problem:

<snip>

test=# \q
could not save history to file "/usr/local/pgsql//.psql_history": Permission
denied

I don't know about the platform, but shouldn't that refer to your home
directory?

Other installations of stable releases of 8.x.x did not have this problem,
though I'm just now running it under Mac OS X Tiger (10.4.6). I'm guessing
it's a Tiger issue but I don't know what to do about it.

Something like: \set HISTFILE 'blah' should do it, check the docs.

That said, shouldn't
/usr/local/pgsql//.psql_history
be
/usr/local/pgsql/.psql_history

There's no difference (semantically) between the two...

Have a nice day,

In reply to: David F. Johnson (#4)
Re: "save history" problem

On Mon, 24 Apr 2006, David F. Johnson wrote:

...
could not save history to file "/usr/local/pgsql//.psql_history": Unknown
error: 0
...

though I'm just now running it under Mac OS X Tiger (10.4.6). I'm guessing
it's a Tiger issue but I don't know what to do about it.

This was answered by Tom Lane in the NOVICE list recently. The
problem is that X.4 uses a fake readline library. You need to
download and install the real GNU Readline, having eliminated the
readline > whatever symlink. Then recompile and reinstall
PostgreSQL.