Re: IF (NOT) EXISTS in psql-completion

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: a(dot)zakirov(at)postgrespro(dot)ru
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: IF (NOT) EXISTS in psql-completion
Date: 2016-02-26 07:37:46
Message-ID: 20160226.163746.176442626.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox
Thread:
Lists: pgsql-hackers

Hello, this is the new version of this patch.

At Fri, 26 Feb 2016 13:17:26 +0900 (Tokyo Standard Time), Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> wrote in <20160226(dot)131726(dot)54224488(dot)horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
> Hello, thank you for the comments.
>
> At Mon, 15 Feb 2016 15:43:57 +0300, Artur Zakirov <a(dot)zakirov(at)postgrespro(dot)ru> wrote in <56C1C80D(dot)7020101(at)postgrespro(dot)ru>
> > I did some tests with your patch. But I am not confident in
> > tab-complete.c.
> >
> > And I have some notes:
> >
> > 1 - I execute git apply command and get the following warning:
> >
> > ../0001-Suggest-IF-NOT-EXISTS-for-tab-completion-of-psql.patch:302:
> > trailing whitespace.
> > /*
> > warning: 1 line adds whitespace errors.
> >
> > This is because of superfluous whitespace I think.
>
> Oops. I'll remove it.
>
> > 2 - In psql I write "create table if" and press <TAB>. psql adds the
> > following:
> >
> > create table IF NOT EXISTS
> >
> > I think psql should continue with lower case if user wrote query with
> > loser case text:
>
> Good catch! Hmm. COMPLETE_WITH_SCHEMA_QUERY() does it. For
> example, the following existing completion behaves in the same
> way.
>
> "drop index c" =<tab>=> "drop index CONCURRENTLY"
>
> The results of schema queries should be treated in case-sensitive
> way so the additional keywords by 'UNION' are also treated
> case-sensitively.
>
> COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_indexes,
> " UNION SELECT 'CONCURRENTLY'");
>
> Fixing this is another problem. So I'd like to leave this alone
> here.
>
> > create table if not exists
> >
> > 3 - Same with "IF EXISTS". If a write "alter view if" and press <TAB>
> > psql writes:
> >
> > alter view IF EXISTS

Finally, the only thing done in this new patch is removing one
dangling space.

reagrds,

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment Content-Type Size
0001-Suggest-IF-NOT-EXISTS-for-tab-completion-of-psql_v2.patch text/x-patch 40.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message pokurev 2016-02-26 08:28:13 Re: [PROPOSAL] VACUUM Progress Checker.
Previous Message Pavel Stehule 2016-02-26 07:34:49 Re: proposal: PL/Pythonu - function ereport