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-03-30 04:40:53 |
Message-ID: | CAFj8pRCvWyOD42djcEY4NEFC9ai+51juVJuYiKU-r5tvAOU5_A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
2016-03-30 5:43 GMT+02:00 Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp
>:
> Hello,
>
> 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"))
> > COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables,
> > ADDLIST2("", "IF EXISTS", "ALL IN TABLESPACE"));
>
> or
>
> > else if (Matches5("ALTER", "TABLE", MatchAny, "DROP", "CONSTRAINT"))
> > {
> > completion_info_charp = prev3_wd;
> > COMPLETE_WITH_QUERY(
> > 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.
> information_schema. pg_toast_temp_1.
> =# alter table i<tab>
> if exists
> information_schema.sql_features
> ...
> =# 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
Regards
Pavel
>
> regards,
>
> --
> Kyotaro Horiguchi
> NTT Open Source Software Center
>
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2016-03-30 04:55:46 | Re: OOM in libpq and infinite loop with getCopyStart() |
Previous Message | Fabrízio de Royes Mello | 2016-03-30 04:06:34 | Re: Sequence Access Method WIP |