Re: IF (NOT) EXISTS in psql-completion

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
Cc: David Steele <david(at)pgmasters(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: IF (NOT) EXISTS in psql-completion
Date: 2016-04-06 20:33:19
Message-ID: CAFj8pRAFFK+5ym+LTSBMjMG-ssxgLxfE_8KM8jrGPY7+1kiv0w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

2016-04-04 7:58 GMT+02:00 Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp
>:

> 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(dot)stehule(at)gmail(dot)com>
> wrote in <
> CAFj8pRADF3rmQ3y33aeR1C7wOi2QsS65C8bBtiRNqU0zWVWayg(at)mail(dot)gmail(dot)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.
>

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
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2016-04-06 20:50:22 Re: VS 2015 support in src/tools/msvc
Previous Message Feld, Michael (IMS) 2016-04-06 20:21:22 Re: pg_upgrade error regarding hstore operator