From: | Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> |
---|---|
To: | pavel(dot)stehule(at)gmail(dot)com |
Cc: | david(at)pgmasters(dot)net, peter_e(at)gmx(dot)net, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: IF (NOT) EXISTS in psql-completion |
Date: | 2016-03-30 08:34:08 |
Message-ID: | 20160330.173408.176121912.horiguchi.kyotaro@lab.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
At Wed, 30 Mar 2016 09:23:49 +0200, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote in <CAFj8pRBVKa6NG4JwZ2QmrO7inudFJws5w0+demVgZZNuF-HUkQ(at)mail(dot)gmail(dot)com>
> Hi
>
> ...
> >> =# alter table if<tab>
> >> =# alter table if exists
> >> ======
> >> =# alter table I<tab>
> >> =# alter table IF EXISTS // "information_schema" doesn't match.
> >>
> >> Since this is another problem from IF (NOT) EXISTS, this is
> >> in separate form.
> >>
> >> What do you think about this?
> >>
> >
> > +1
> >
>
> The new behave is much better.
I'm glad to hear that.
> I found new warning
>
> tab-complete.c:1438:87: warning: right-hand operand of comma expression
> has no effect [-Wunused-value]
Mmm. Google said me that gcc 4.9 does so. I'm using 4.8.5 so I
haven't see the warning.
https://gcc.gnu.org/gcc-4.9/porting_to.html
1436: else if (HeadMatches2("CREATE", "SCHEMA") &&
1437: SHIFT_TO_LAST1("CREATE") &&
1438: false) {} /* FALL THROUGH */
> #define SHIFT_TO_LAST1(p1) \
> (HEADSHIFT(find_last_index_of(p1, previous_words, previous_words_count)), \
> true)
> #define HEADSHIFT(n) \
> (head_shift += n, true)
expanding the macros the lines at the error will be
else if (HeadMatches2("CREATE", "SCHEMA") &&
(head_shift +=
find_last_index_of("CREATE", previous_words, previous_words_count),
true) &&
false) {} /* FALL THROUGH */
But the right hand value (true) is actually "used" in the
expression (even though not effective). Perhaps (true && false)
was potimized as false and the true is regarded to be unused?
That's stupid.. Using functions instead of macros seems to solve
this but they needed to be wraped by macros as
additional_kw_query(). That's a pain..
Any thougts?
> There is small minor issue - I don't know if it is solvable. Autocomplete
> is working only for "if" keyword. When I am writing "if " or "if " or "if
> exi" - then autocomplete doesn't work. But this issue is exactly same for
> other "multi words" completation like "alter foreign data wrapper". So if
> it is fixable, then it can be out of scope this patch.
Yes. It can be saved only by adding completion for every word,
as some of the similar completion is doing.
> anything else looks well.
Thanks.
regards,
--
Kyotaro Horiguchi
NTT Open Source Software Center
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Hagander | 2016-03-30 08:50:04 | Re: Missing mention of GSSAPI in MSVC's config_default.pl |
Previous Message | Amit Langote | 2016-03-30 08:24:09 | Re: [postgresSQL] [bug] Two or more different types of constraints with same name creates ambiguity while drooping. |