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-06 16:10:43
Message-ID: CAFj8pRD85cnxEEgLtOoqL-Bda2XpzvHB3a6Mr+bvf+OKpiq3Eg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

2017-02-03 9:17 GMT+01:00 Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp
>:

> Hello. This is the new version of this patch.
>
> - Rebased to the current master (555494d)
> PUBLICATION/SUBSCRIPTION stuff conflicted.
>
> - Fix a bug of CREATE INDEX(0012-Simplify-completion-for-CREATE-INDEX.
> patch).
> CREATE INDEX ON no longer gets a suggestion of "ON".
>
> - Added logging feature (0018-Debug-output-of-psql-completion.patch)
>
> This might be suitable to be a separate patch. psql completion
> code is defficult to debug when it is uncertain what line did a
> suggestion. This patch allows completion logs to psql log,
> which is activated by -L option.
>
> psql -L <logfile> <dbname>
>
> And the logs like the following will be printed.
>
> | completion performed at tab-complete.c:1146 for "do"
>
> - OR REPLACE suggestion (0019-Add-suggestion-of-OR-REPLACE.patch)
>
> At Wed, 1 Feb 2017 09:42:54 +0100, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
> wrote in <CAFj8pRAHCwdwe+NRTQ9JrtMO2OdUWtp1demmv_
> jGBU2tRRs-CQ(at)mail(dot)gmail(dot)com>
> > 2017-02-01 9:37 GMT+01:00 Kyotaro HORIGUCHI <
> horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp
> > the content of my last mail is a copy my mail from end of December.
> > Probably lot of changes there.
>
> Thanks for reposting.
>
> > > > 2. tab complete doesn't work well if I am manually writing "create
> index
> > > > on" - second "ON" is appended - it is a regression
> > >
> > > I'll fix it in the version.
> > >
> > > > I didn't find any other issues -
> > > >
> > > > note: not necessary to implement (nice to have) - I miss a support
> for OR
> > > > REPLACE flag - it is related to LANGUAGE, TRANSFORMATION, FUNCTION
> and
> > > > RULE.
>
> Hmm. This patch perhaps should not 'add a feature' (how about the
> logging..). Anyway the last 19th patch does that. The word
> removal framework works well for this case.
>
> After all, this patch is so large that I'd like to attach them as
> one compressed file. The content of the file is the following.
>
>
> 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.

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.

2. the list of possible functions after EXECUTE PROCEDURE in CREATE TRIGGER
statement should be reduced to trigger returns function only.

CREATE OR REPLACE FUNCTIONS works great, thank you!

Regards

Pavel

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-02-06 16:17:07 Re: [RFC] Should "SHOW huge_pages" display the effective value "off" when the huge page is unavailable?
Previous Message Fujii Masao 2017-02-06 16:04:34 Re: [RFC] Should "SHOW huge_pages" display the effective value "off" when the huge page is unavailable?