From: | Kirk Wolak <wolakk(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Andres Freund <andres(at)anarazel(dot)de>, Thomas Munro <thomas(dot)munro(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 04:38:32 |
Message-ID: | CACLU5mS3DxRTaQ81Mu8qXvbBm50Ezk0N0a1KuvYgNupzUPU8QQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, Nov 23, 2022 at 9:57 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > I think it'd be easier to deal with this if COMPLETE_WITH_* caused the
> the
> > containing function to return. Then the completions wouldn't need to be
> in one
> > huge if-else if. Leaving msvc aside, that also seems nice for efficiency.
>
> Yeah, that could be an easy quick-fix. We'd need to refactor so that
> the cleanup housekeeping at the bottom of psql_completion() was in a
> wrapper function, but perhaps that wouldn't be too messy.
>
> regards, tom lane
>
Thinking about how this code is structured, maybe psql_completion() becomes
the wrapper:
psql_completion()
{
// Pre-amble, setup
psql_parse_completion(...); // if/else structure moved
// house keeping for the returns
}
psql_parse_completion(...)
{
// more complex preamble stuff
...
// an EXTRA trap if nothing matched unexpectedly is now possible if
everything else returns?
}
After dealing with this code, the flow was hard to follow, something like
this makes it easier.
Also, at some point, if we wanted to write an alternative "grammar driven"
approach, we could
literally call both procedures and compare the results for validation...
regards Kirk
From | Date | Subject | |
---|---|---|---|
Next Message | Nikolas Hanry | 2022-11-24 07:36:26 | Fwd: Change the auth. postgresql and GIS |
Previous Message | Kirk Wolak | 2022-11-24 04:26:03 | Re: Getting PSQL in Windows to support TAB/Autocomplete via modified readline... |