Re: Readline support in psql -- worked earlier for me

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Peter Kovacs" <maxottovonstirlitz(at)gmail(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Readline support in psql -- worked earlier for me
Date: 2008-06-19 18:06:50
Message-ID: 19058.1213898810@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

"Peter Kovacs" <maxottovonstirlitz(at)gmail(dot)com> writes:
> Gosh, it is working now -- now that I am connected to my local
> postgresql instance. I assume psql's behavior doesn't depend on the
> version/location/readline-support of backend, correct?

I just found that psql on my Fedora machine ignores ~/.inputrc,
just like you said. Some poking around turned up the reason;

$ env | grep -i inp
INPUTRC=/etc/inputrc

Per the readline manual:

Any user can customize programs that use Readline by
putting commands in an "inputrc" file, conventionally in his home
directory. The name of this file is taken from the value of the
environment variable `INPUTRC'. If that variable is unset, the default
is `~/.inputrc'. If that file does not exist or cannot be read, the
ultimate default is `/etc/inputrc'.

Further poking found this in /etc/profile:

if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
INPUTRC=/etc/inputrc
fi

So the answer seems to be that if you create an ~/.inputrc that wasn't
there before, it won't work till you start a new shell, at least if
you've got a system that presets INPUTRC for you like this.

I find this pretty stupid, actually, since per the manual readline
can fall back to /etc/inputrc all by itself; all the /etc/profile code
is accomplishing is to screw up this corner case. Off to file something
in bugzilla.

regards, tom lane

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Travis Smith 2008-06-19 18:10:23 Re: Recover Password
Previous Message Kevin Grittner 2008-06-19 17:56:51 Re: Revoke for a new role