Re: Readline support in psql -- worked earlier for me - Mailing list pgsql-admin

From Tom Lane
Subject Re: Readline support in psql -- worked earlier for me
Date
Msg-id 19058.1213898810@sss.pgh.pa.us
Whole thread Raw
In response to Readline support in psql -- worked earlier for me  ("Peter Kovacs" <maxottovonstirlitz@gmail.com>)
Responses Re: Readline support in psql -- worked earlier for me  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-admin
"Peter Kovacs" <maxottovonstirlitz@gmail.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

pgsql-admin by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: Revoke for a new role
Next
From: Dilip Patel
Date:
Subject: Recover Password