Re: IF (NOT) EXISTS in psql-completion

Поиск
Список
Период
Сортировка
От Kyotaro HORIGUCHI
Тема Re: IF (NOT) EXISTS in psql-completion
Дата
Msg-id 20160929.161600.224338668.horiguchi.kyotaro@lab.ntt.co.jp
обсуждение исходный текст
Ответ на Re: IF (NOT) EXISTS in psql-completion  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: IF (NOT) EXISTS in psql-completion  (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>)
Список pgsql-hackers
Thank you for reviewing!

At Mon, 19 Sep 2016 11:11:03 +0200, Pavel Stehule <pavel.stehule@gmail.com> wrote in
<CAFj8pRCpoYMoUzZ74p0JvX=orUxs7o88UR0z0-Lqt6W6bS9DaQ@mail.gmail.com>
> >> 2. Make keywords' case follow to input
> >>
> >>   Allow the keywords suggested along with databse objects to
> >>   follow the input letter case. The core part of this patch is a
> >>   new function additional_kw_query(), which dynamically generates
> >>   additional query string with specified keywords in the desired
> >>   letter case. COMPLETE_WITH_* macros are modified to accept the
> >>   function.
> >>
> >>
> second patch is working, but I don't think it is enough documented

Mmm. I should admit that. I will add comments in it.

> what is addon in COMPLETE_WITH_QUERY(query, addon)? semantics, usage?

Original COMPLETE_WITH_QUERY gets only query, but it is used in
the form when additional keywords are needed.

| COMPLETE_WITH_QUERY(Query_for_list_of_roles " UNION SELECT 'DEFAULT'");

This is a string literal concatenation which is available only on
compile time. Letter case modification needs this done in
runtime. So it should be given as a separate parameter from the
main query.

> in 99% the addon is "" when macro
> COMPLETE_WITH_SCHEMA_QUERY,COMPLETE_WITH_QUERY is used. Maybe a
> introduction of new macros with nonempty addon parameter should be better.

That looks better. I'll change the API as the following.

COMPLETE_WITH_QUERY(query);
COMPLETE_WITH_QUERY_KW(query, kwlist);
COMPLETE_WITH_SCHEMA_QUERY(squery);
COMPLETE_WITH_SCHEMA_QUERY_KW(squery, kwlist);


> > 3. Fix suggested keywords to follow input in tab-completion session 2
> >>
> >>   The 2nd patch above leaves some query string containing static
> >>   keyword strings, which results in failure to follow input
> >>   letter cases. Most of them are naturally removed but role names
> >>   are a bother. This patch puts additional query strings for
> >>   several usage of roles but it might be overdone.
> >>
> >
> this patch looks well
> 
> 
> >
> >> 4. Introduce word shift and removal feature to psql-completion
> >>
> >>   This is the second core for the flexibility of completion code.
> >>   The word shift feature is the ability to omit first several
> >>   words in *MatchesN macros. For example this allows complete
> >>   create-schema's schema elements in a natural code. (Currently
> >>   those syntaxes that can be a schema elements are using
> >>   TailMatches instead of Matches, as the result HeadMatches are
> >>   not available there). The words removing feature is the ability
> >>   to (desructively) clip multiple suceessive words in the
> >>   previous_words list. This feature allows suceeding completion
> >>   code not to care about the removed words, such like UNIQUE,
> >>   CONCURRENTLY, VERBOSE and so on.
> >>
> >
> I am thinking so commit's description should be inside README

Currently psql or tab-complete.c/psql_completion() have no such
document. If this should be written as README, perhaps I should
write about completion in general. On the other hand, per-macro
explanations are written in tab-complete-macros.h but the usages
are not. I'll try to write README.

regards,

-- 
Kyotaro Horiguchi
NTT Open Source Software Center





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

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: Handling dropped attributes in pglogical_proto
Следующее
От: Dilip Kumar
Дата:
Сообщение: Re: Speed up Clog Access by increasing CLOG buffers