Re: IF (NOT) EXISTS in psql-completion

Поиск
Список
Период
Сортировка
От Kyotaro HORIGUCHI
Тема Re: IF (NOT) EXISTS in psql-completion
Дата
Msg-id 20160404.145843.239250938.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  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
Thank you for testing. That is a silly mistake, sorry.

The attached is the fixed version.

# Can I add a suffix to format-patche's output files?

At Sat, 2 Apr 2016 07:18:32 +0200, Pavel Stehule <pavel.stehule@gmail.com> wrote in
<CAFj8pRADF3rmQ3y33aeR1C7wOi2QsS65C8bBtiRNqU0zWVWayg@mail.gmail.com>
> >> Finally I settled it by replacing comma expression with logical
> >> OR or AND expresssion. gcc 4.9 compains for some unused variables
> >> in flex output but it is the another issue.
> >>
> >> I forgot to address COMPLETE_WITH_ATTTR but it needed an overhaul
> >> of some macros and changing the type of completion_charp. The
> >> third patch does it but it might be unacceptable..
> >>
> >>
> > something is wrong, autocomplete for CREATE TABLE IF NOT EXISTS doesn't
> > work
> >
> 
> CREATE UNLOGGED/TEMP table is working.

Mmm. I mitakenly refactored multi-step matching.

>   else if (HeadMatches3("CREATE", MatchAny, "TABLE") &&
>        MidMatchAndRemove1(1, "TEMP|TEMPORARY|UNLOGGED") &&
>        Matches2("CREATE", "TABLE"))
>     COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables,
>                    ADDLIST1("IF NOT EXISTS"));

The completion runs only for CREATE AnyKeyword TABLE when
AnyKeyword is removable. It is wrong to do so when any of
prev_words[] that matches the last Matches() can be fileterd out
by the first Headmatches(). The same kind of mistake was found in
the following syntaxes. CREATE SEQENCE had one more mistake.


"CREATE [UNIQUE] INDEX"
"CREATE [TEMP] SEQUENCE"
"CREATE [TEMP..] TABLE"

It is arguable that it is proper to suggest existing object for
CREATE statement, but most of the statement is suggested. It is
semantically wrong but practically useful to know what kind of
word should be there.

regards,

-- 
Kyotaro Horiguchi
NTT Open Source Software Center

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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: Proposal: RETURNING primary_key()
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: pgbench more operators & functions