Search Postgresql Archives

Re: Getting PSQL in Windows to support TAB/Autocomplete via modified readline...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 23, 2022 at 9:57 PM Tom Lane <tgl@xxxxxxxxxxxxx> wrote:
Andres Freund <andres@xxxxxxxxxxx> 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




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux