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

From Kirk Wolak
Subject Re: Getting PSQL in Windows to support TAB/Autocomplete via modified readline...
Date
Msg-id CACLU5mRRLAW2kca3k2gVDM8kow6wgvT_BCaeg37jz=Kyj1afvw@mail.gmail.com
Whole thread Raw
In response to Re: Getting PSQL in Windows to support TAB/Autocomplete via modified readline...  (Andres Freund <andres@anarazel.de>)
List pgsql-general


On Wed, Nov 23, 2022 at 7:41 PM Andres Freund <andres@anarazel.de> wrote:
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.

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

That's exactly what I did:
int if_continues = 0;  // declared at the top

Circa Line 3,900
else
  if_continues = 1;  // break huge if
if (if_continues == 0)  
  NULL;
else ... // This else picks up here again

and you could replace the NULL with if_continues = 0;  to allow breaking it again in the future with the same variable.
I've never seen a single statement that long...

Regards Kirk

pgsql-general by date:

Previous
From: Kirk Wolak
Date:
Subject: Re: Getting PSQL in Windows to support TAB/Autocomplete via modified readline...
Next
From: David Rowley
Date:
Subject: Re: table inheritance partition and indexes