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 20221124004144.iosgze2qnmcctgsh@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>)
Re: Getting PSQL in Windows to support TAB/Autocomplete via modified readline...  (Kirk Wolak <wolakk@gmail.com>)
List pgsql-general
Hi,

On 2022-11-23 18:11:22 -0500, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > On 2022-11-21 10:58:06 -0500, Tom Lane wrote:
> >> It'd certainly be nice if we could use Readline on Windows.
> 
> > 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.
> 
> Huh ... do you recall the details?  Large as tab-complete is, it's
> far smaller than gram.y:

I think the problem was that msvc couldn't quite deal with VA_ARGS_NARGS. Or
something like that.

<tinker, curse, tinker>

Ah, yes:
../src/bin/psql/tab-complete.c(4064): fatal error C1026: parser stack overflow, program too complex

We discussed something around VA_ARGS_NARGS not working on windows:
https://postgr.es/m/f450fc57-a147-19d0-e50c-33571c52cc13%40postgrespro.ru
But now I don't immediately see the above error as being related.


If I remove all the completions after
    /* Complete INSERT INTO with table names */
    else if (TailMatches("INSERT", "INTO"))
        COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_updatables);

it builds with msvc as well. And when using a readline sourced from vcpkg, it
even links. Of course only a few of the completions work, given that I
truncated a whole lot of them away...


So It might just be that we need to split up that very long "else if" chain in
psql_completion().

Greetings,

Andres Freund



pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Getting PSQL in Windows to support TAB/Autocomplete via modified readline...
Next
From: Tom Lane
Date:
Subject: Re: Getting PSQL in Windows to support TAB/Autocomplete via modified readline...