At Tue, 20 Sep 2016 16:50:29 +0900, Michael Paquier <michael.paqu...@gmail.com>
wrote in <cab7npqry1b++xj26mb+aujxzqhs_1qwmi+mowqjtdubkxuu...@mail.gmail.com>
> On Mon, Sep 19, 2016 at 6:11 PM, Pavel Stehule <pavel.steh...@gmail.com>
> > I am thinking so commit's description should be inside README
> Horiguchi-san, your patch has some whitespace issues, you may want to
> get a run with git diff --check. Here are some things I have spotted:
> src/bin/psql/tab-complete.c:1074: trailing whitespace.
> + "MATERIALIZED VIEW",
> src/bin/psql/tab-complete.c:2621: trailing whitespace.
> + COMPLETE_WITH_QUERY(Query_for_list_of_roles,
Thank you very much for pointing it out. I put a pre-commit hook
to check that not to do such a mistake again.
> This set of patches is making psql tab completion move into a better
> shape, particularly with 0001 that removes the legendary huge if-elif
> and just the routine return immediately in case of a keyword match.
> Things could be a little bit more shortened by for example not doing
> the refactoring of the tab macros because they are just needed in
> tab-complete.c. The other patches introduce further improvements for
> the existing infrastructure, but that's a lot of things just for
> adding IF [NOT] EXISTS to be honest.
It was the motive for this, but even excluding it, some syntaxes
with optional keywords can be simplified or enriched with the new
macros. CREATE SCHEMA's schema elements, CREATE INDEX and some
other syntaxes are simplified using the feature.
> Testing a bit, I have noticed that for example trying to after typing
> "create table if", if I attempt to do a tab completion "not exists"
> does not show up. I suspect that the other commands are failing at
> that as well.
I suppose it is "create table if ", with a space at the tail. It
is a general issue on combined keywords(?) suggestion in the
whole tab-completion mechanism (or readline's limitation). Some
sytaxes have explicit complition for such cases. For examle,
"create foreign " gets a suggestion of "DATA WRAPPER" since it
has an explcit suggestion step.
> /* ALTER FOREIGN */
> if (Matches2("ALTER", "FOREIGN"))
> COMPLETE_WITH_LIST2("DATA WRAPPER", "TABLE");
It is apparently solvable, but needs additional code to suggest
the rest words for every steps. It should be another issue.
NTT Open Source Software Center
Sent via pgsql-hackers mailing list (email@example.com)
To make changes to your subscription: