Re: psql & readline & win32 - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: psql & readline & win32
Date
Msg-id 200602130401.k1D41OZ09565@candle.pha.pa.us
Whole thread Raw
In response to psql & readline & win32  ("Magnus Hagander" <mha@sollentuna.net>)
List pgsql-hackers
Would the easiest solution be to make a patch to readline for Win32, and
only allow Win32 to link to readline if that patch is in readline, and
spit out a compile error if readline doesn't have that patch.

As far as the license, psql spits out a copyright notice as it starts. 
It would be a shame to have to mention GPL in there.

Can we get any companies to fund a port of libedit to Win32?  What does
readline have that Win32 native editing does not?


---------------------------------------------------------------------------

Magnus Hagander wrote:
> Getting started early this year, I've finally found a way around the
> issues with readline on win32. And it just took a little bit 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 generate will 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 couple of 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 and specifically
> 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 common ones 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 launch psql. 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 specify program-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 makes it 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 build them, of course
> :-)
> 
> 
> 
> //Magnus
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
> 

-- Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Why don't we allow DNS names in pg_hba.conf?
Next
From: mani
Date:
Subject: TODO Item - "Allow INSERT INTO tab (col1, ..) VALUES (val1, ..), (val2, ..)"