psql & readline & win32 - Mailing list pgsql-hackers

From Magnus Hagander
Subject psql & readline & win32
Date
Msg-id 6BCB9D8A16AC4241919521715F4D8BCE92E96A@algol.sollentuna.se
Whole thread Raw
Responses Re: psql & readline & win32
Re: psql & readline & win32
List pgsql-hackers
Getting started early this year, I've finally found a way around the issues with readline on win32. And it just took a
littlebit of google research and some testing. 


Recap of the problem: When running psql in a readline enabled mode on win32, any character requiring the AltGr key to
generatewill not work. In a lot of non-US locales, this includes the backslash key, which makes psql pretty darn
unusable.The "fix" for this that went into 8.0 is to disable readline on win32 pending a fix. 

Now, this can be fixed. And it's as simple as specifying an inputrc file. For backslash, this file needs to contain:
"\M-\\": "\\"

And then similarly for every other character requiring AltGr.

Considering we have a fix, I think we need to re-enable readline on win32, and document this. However, there are a
coupleof things to decide on first: 

1) Should it be made default? As it requires you to include this file to work, perhaps it should be set to non-default
andspecifically require a --with-readline? Also depends on th eanswers of a couple of questions below, I think. 

2) Should we ship a file of standard bindings. We're not going to get it complete, but we could get some of the most
commonones in europe at least (in sweden, this would for example include "\@£${[]}~|"). Which would help people a lot. 

3) How should the inputrc file be loaded. By default, you have to type SET INPUTRC="\some\where\inputrc" before you
launchpsql. But we could just as easily add: 
#if defined(WIN32) && defined(USE_READLINE)  rl_read_init_file(our_path_to_inputrc);
#endif
to psql, making that step a whole lot easier. Especially for people who launch psql from the startmenu, and can't
specifyprogram-specific env vars. 

If we wanted to, we could even bind the keys using rl_parse_and_bind() or similar, but keeping it in a separate file
makesit possible to edit it without recompiling, which is a definite plus. 


4) Can we ship linked with readline in the installer? If not, can we ship a readline-linked binary at all, or just the
source?Considering readline drags along the GPL, and not just the LGPL. (We can link either statically (default) or
dynamically(separate package) to readline without problems, from what I can tell) 

I think we ship readline-linked RPMs, but I'm not sure about that?

Now even if we can't ship readline linked binaries in the installer, it's still a good thing to provide the ability to
buildthem, of course :-) 



//Magnus


pgsql-hackers by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Removing SORTFUNC_LT/REVLT
Next
From: Tom Lane
Date:
Subject: Re: EINTR error in SunOS