Re: IF (NOT) EXISTS in psql-completion

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: pavel(dot)stehule(at)gmail(dot)com
Cc: michael(dot)paquier(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: IF (NOT) EXISTS in psql-completion
Date: 2017-02-03 08:17:12
Message-ID: 20170203.171712.150614683.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.

- 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..

regards,

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment Content-Type Size
if_not_exists_20170203.tar.gz application/octet-stream 49.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro HORIGUCHI 2017-02-03 08:34:48 Re: Logical Replication and Character encoding
Previous Message Thomas Munro 2017-02-03 08:05:47 Re: Non-deterministic behavior with floating point in parallel mode