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>
Cc: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, 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-24 00:41:44
Message-ID: 20221124004144.iosgze2qnmcctgsh@awork3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

On 2022-11-23 18:11:22 -0500, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2022-11-24 01:28:29 Re: Getting PSQL in Windows to support TAB/Autocomplete via modified readline...
Previous Message Tom Lane 2022-11-23 23:11:22 Re: Getting PSQL in Windows to support TAB/Autocomplete via modified readline...