|From:||Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>|
|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|
|Views:||Raw Message | Whole Thread | Download mbox|
At Tue, 29 Mar 2016 13:12:06 +0200, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote in <CAFj8pRCnrpdSqSozg4Y8__2LFyiNqUCE=KPzFw1+AF_LutmRiQ(at)mail(dot)gmail(dot)com>
> 2016-03-29 12:08 GMT+02:00 Kyotaro HORIGUCHI <
> > > > As mentioned before, upper-lower problem is an existing
> > > > issue. The case of the words in a query result list cannot be
> > > > edited since it may contain words that should not be changed,
> > > > such as relation names. So we can address it only before issueing
> > > > a query but I haven't found simple way to do it.
> > > >
> > >
> > > This is unpleasant. I am sorry. I had very uncomfortable feeling from
> > this
> > > behave. I am thinking so it should be solvable - you have to convert only
> > > keyword IF EXISTS or IF NOT EXISTS. Maybe there are not trivial solution,
> > > but this should be fixed.
> > I understand that and feel the same. But I don't want to put
> > puzzling code. Defining a macro enable this by writing as the
> > following.
> puzzle is wrong, but nonconsistent behave is not acceptable
Mmm. Ok, The attched patch, which applies on top of the
IF(NOT)EXIST patch, does this in rather saner appearance, but
needs to run additional C function at runtime and additional some
macros. The function is called up to once per completion, so it
won't be a performance problem.
> else if (Matches2("ALTER", "TABLE"))
> ADDLIST2("", "IF EXISTS", "ALL IN TABLESPACE"));
> else if (Matches5("ALTER", "TABLE", MatchAny, "DROP", "CONSTRAINT"))
> completion_info_charp = prev3_wd;
> ADDLIST1(Query_for_constraint_of_table, "IF EXISTS"));
I think this syntax is acceptable. Only keywords follows the
setting of COMP_KEYWORD_CASE, as Artur suggested.
=# alter table <tab>
ALL IN TABLESPACE pg_catalog. public.
alpha. pg_temp_1. x
IF EXISTS pg_toast.
=# alter table i<tab>
=# 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?
NTT Open Source Software Center
|Next Message||Kyotaro HORIGUCHI||2016-03-30 04:01:03||Re: PATCH: index-only scans with partial indexes|
|Previous Message||David Rowley||2016-03-30 03:14:38||Re: Combining Aggregates|