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

Поиск
Список
Период
Сортировка
От Kirk Wolak
Тема Re: Getting PSQL in Windows to support TAB/Autocomplete via modified readline...
Дата
Msg-id CACLU5mS3DxRTaQ81Mu8qXvbBm50Ezk0N0a1KuvYgNupzUPU8QQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Getting PSQL in Windows to support TAB/Autocomplete via modified readline...  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On Wed, Nov 23, 2022 at 9:57 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Andres Freund <andres@anarazel.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



В списке pgsql-general по дате отправления:

Предыдущее
От: Kirk Wolak
Дата:
Сообщение: Re: Getting PSQL in Windows to support TAB/Autocomplete via modified readline...
Следующее
От: Nikolas Hanry
Дата:
Сообщение: Fwd: Change the auth. postgresql and GIS