Re: Getting PSQL in Windows to support TAB/Autocomplete via modified readline... - Mailing list pgsql-general

From Andres Freund
Subject Re: Getting PSQL in Windows to support TAB/Autocomplete via modified readline...
Date
Msg-id 20221123230256.m23somxrmvdyoimk@awork3.anarazel.de
Whole thread Raw
In response to Re: Getting PSQL in Windows to support TAB/Autocomplete via modified readline...  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Getting PSQL in Windows to support TAB/Autocomplete via modified readline...  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
hi,

On 2022-11-21 10:58:06 -0500, Tom Lane wrote:
> Kirk Wolak <wolakk@gmail.com> writes:
> >   We have our team of Windows developers, leveraging PSQL.  But honestly,
> > it feels crippled after using PSQL in Linux for any length of time.  Losing
> > auto-complete sucks (multi-line query recall/editing is lost as well).
>
> >   In researching this problem, it appears that the decision was made like
> > 17yrs ago, when windows did not have a realistic "terminal" type
> > interface.  Assuming we target Windows 8.1 or higher, I believe this goes
> > away.
>
> It'd certainly be nice if we could use Readline on Windows.

FWIW, when building postgres with meson and mingw, you end up with a working
readline today (provided readline is installed). That ended up working mostly
accidentally.  See here for a few more details:
https://www.postgresql.org/message-id/20220928022724.erzuk5v4ai4b53do%40awork3.anarazel.de

I think there might still be something weird with ctrl-c, but that's not
really related to readline.


Readline doesn't currently work when building msvc for two reasons:

1) Readline doesn't provide an import library. Mingw implements a workaround
   for that by basically generating one at link time, but msvc doesn't.

   An import library can be fairly easily be generated. Or one could propose a
   patch to upstream readline to add support for generating readline.

2) The last time I checked, msvc couldn't preprocess tab-complete.c with
   USE_READLINE defined, due to running into some preprocessor limits. We can
   probably fix that on our end somehow.


Greetings,

Andres Freund



pgsql-general by date:

Previous
From: Ted Toth
Date:
Subject: Re: table inheritance partition and indexes
Next
From: Tom Lane
Date:
Subject: Re: Getting PSQL in Windows to support TAB/Autocomplete via modified readline...