On 2019-09-29 22:55, Andrew Dunstan wrote:
>
> The configure code currently has this:
>
>
> # readline on MinGW has problems with backslashes in psql and other bugs.
> # This is particularly a problem with non-US code pages.
> # Therefore disable its use until we understand the cause. 2004-07-20
> if test "$PORTNAME" = "win32"; then
> if test "$with_readline" = yes; then
> AC_MSG_WARN([*** Readline does not work on MinGW --- disabling])
> with_readline=no
> fi
> fi
>
>
> 2004 is a very long time ago. Has anyone looked at this more recently?
> It would certainly be nice to have readline-enabled psql on Windows if
> possible.
I tried this out. First, it doesn't build, because readline doesn't do
the dllimport/dllexport dance on global variables, so all references to
rl_* global variables in tab-complete.c fail (similar to [0]). After
patching those out, it builds, but it doesn't work. It doesn't print a
prompt, keys don't do anything sensible. I can enter SQL commands and
get results back, but the readline part doesn't do anything sensible AFAICT.
Perhaps I did something wrong. You can still use readline without
global variables, but it seems like a serious restriction and makes me
wonder whether this has actually ever been used before. It's curious
that MSYS2 ships a readline build for mingw. Is there other software
that uses it on Windows?
[0]:
https://www.postgresql.org/message-id/001101c3eb6a$3b275500$f800a8c0@kuczek.pl
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services