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: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: IF (NOT) EXISTS in psql-completion
Date: 2017-02-21 19:08:48
Message-ID: CAFj8pRAgwABQUVkbLVnEjDp+OgLWwK3w5P9pC985xfTz+Qbqug@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2017-02-14 11:51 GMT+01:00 Kyotaro HORIGUCHI <
horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>:

> Thank you for the comment.
>
> At Mon, 6 Feb 2017 17:10:43 +0100, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
> wrote in <CAFj8pRD85cnxEEgLtOoqL-Bda2XpzvHB3a6Mr+bvf+OKpiq3Eg@
> mail.gmail.com>
> > > 0001-Refactoring-tab-complete-to-make-psql_completion-cod.patch
> > > - Just a refactoring of psql_completion
> > >
> > > 0002-Make-keywords-case-follow-to-input.patch
> > > - The letter case of additional suggestions for
> > > COMPLETION_WITH_XX follows input.
> > >
> > > 0003-Introduce-word-shift-and-removal-feature-to-psql-com.patch
> > > - A feature to ignore preceding words. And a feature to remove
> > > intermediate words.
> > >
> > > 0004-Add-README-for-tab-completion.patch
> > > - README
> > >
> > > 0005-Make-SET-RESET-SHOW-varialble-follow-input-letter-ca.patch
> > > 0006-Allow-complete-schema-elements-in-more-natural-way.patch
> > > 0007-Allow-CREATE-RULE-to-use-command-completion-recursiv.patch
> > > 0008-Allow-completing-the-body-of-EXPLAIN.patch
> > > 0009-Simpilfy-ALTER-TABLE-ALTER-COLUMN-completion.patch
> > > 0010-Simplify-completion-for-CLUSTER-VERBOSE.patch
> > > 0011-Simplify-completion-for-COPY.patch
> > > 0012-Simplify-completion-for-CREATE-INDEX.patch
> > > 0013-Simplify-completion-for-CREATE-SEQUENCE.patch
> > > 0014-Simplify-completion-for-DROP-INDEX.patch
> > > 0015-Add-CURRENT_USER-to-some-completions-of-role.patch
> > > 0016-Refactor-completion-for-ALTER-DEFAULT-PRIVILEGES.patch
> > > 0017-Add-suggestions-of-IF-NOT-EXISTS.patch
> > > - A kind of sample refctoring (or augmenting) suggestion code
> > > based on the new infrastructure.
> > >
> > > 0018-Debug-output-of-psql-completion.patch
> > > - Debug logging for psql_completion (described above)
> > >
> > > 0019-Add-suggestion-of-OR-REPLACE.patch
> > > - Suggestion of CREATE OR REPLACE.
> > >
> > >
> > > # I hear the footsteps of another conflict..
> > >
> > The patch 0018 was not be applied.
>
> The fear came true. fd6cd69 conflicts with it but on a
> comment. The attached patch set applies on top of the current
> master head (ae0e550).
>

Now first patch is broken :(

It is pretty sensitive to any changes. Isn't possible to commit first four
patches first and separately maybe out of commitfest window?

>
> > Few other notes from testing - probably these notes should not be related
> > to your patch set
> >
> > 1. When we have set of keywords, then the upper or lower chars should to
> > follow previous keyword. Is it possible? It should to have impact only on
> > keywords.
>
> It sounds reasonable, more flexible than "upper"/"lower" of
> COMP_KEYWORD_CASE. The additional 20th(!) patch does that. It
> adds a new value 'follow-first' to COMP_KEYWORD_CASE. All
> keywords in a command line will be in the case of the first
> letter of the first word. ("CREATE" in the following case. I
> think it is enogh for the purpose.)
>
> postgres=# \set COMP_KEYWORD_CASE follow-first
> postgres=# CREATE in<tab>
> =># CREATE INDEX hoge <tab>
> =># CREATE INDEX hoge ON emp<tab>
> =># CREATE INDEX hoge ON employee ..
> postgres=# create IN<tab>
> =># create index
>
> Typing tab at the first in a command line shows all available
> keywords in upper case.
>

It is great - from my perspective the best step in last years in this area.

>
> > 2. the list of possible functions after EXECUTE PROCEDURE in CREATE
> TRIGGER
> > statement should be reduced to trigger returns function only.
>
> Actually Query_for_list_of_trigger_functions returns too many
> candidates. The suggested restriction reduces them to a
> reasonable number. The 21th patch does that.
>
> > CREATE OR REPLACE FUNCTIONS works great, thank you!
>
> Thanks. It was easier than expected.
>
> As the result, 21 paches are attached to this message. 1 - 19th
> are described above and others are described below.
>
> 0020-New-COMP_KEYWORD_CASE-mode-follow-first.patch
>
> - Add new COMP_KEYWORD_CASE mode "follow-first". The completion
> works with the case of the first word. (This doesn't rely on
> this patchset but works in more cases with 0002)
>
> 0021-Suggest-only-trigger-functions-for-CREAET-TRIGGER.EX.patch
> - Restrict suggestion for the syntax to ones acutually usable
> there. (This relies on none of this patchset, though..)
>
> regards,
>

Thank you very much for this your work.

Regards

Pavel

>
> --
> Kyotaro Horiguchi
> NTT Open Source Software Center
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2017-02-21 19:54:17 pg_dump does not refresh matviews from extensions
Previous Message Fujii Masao 2017-02-21 18:44:27 Re: Resolved typo in a comment