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.
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.
I tested this patch and I didn't find any problem.
1. We want this patch - it increase a functionality of autocomplete - IF (NOT) EXISTS is relative long phrase and autocomplete is nice. - next implementation can be CREATE "OR REPLACE" FUNCTION
2. The patch is possible to apply - no problems, no problems with compiling
3. All regress tests passed without problems
4. Patch respects PostgreSQL's codding style and it is enough commented
5. The regress tests are not possible - interactive process
6. The documentation is not necessary
7. It should not to have any impacts on SQL or performance
I'll mark this patch as ready for commiter
Thank you for the patch
Regards
Pavel
regards,
-- Kyotaro Horiguchi NTT Open Source Software Center