Re: Getting PSQL in Windows to support TAB/Autocomplete via modified readline...

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: Kirk Wolak <wolakk(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Getting PSQL in Windows to support TAB/Autocomplete via modified readline...
Date: 2022-11-23 23:02:56
Message-ID: 20221123230256.m23somxrmvdyoimk@awork3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hi,

On 2022-11-21 10:58:06 -0500, Tom Lane wrote:
> Kirk Wolak <wolakk(at)gmail(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2022-11-23 23:11:22 Re: Getting PSQL in Windows to support TAB/Autocomplete via modified readline...
Previous Message Ted Toth 2022-11-23 22:34:02 Re: table inheritance partition and indexes