[PATCH] ALTER tab completion

Started by Ken Katoover 4 years ago4 messageshackers
Jump to latest
#1Ken Kato
katouknl@oss.nttdata.com

Hi hackers,

I noticed that there are some tab completions missing for the following
commands:
-ALTER DEFAULT PRIVILEGES: missing FOR USER
-ALTER FOREIGN DATA WRAPPER: missing NO HANDLER, NO VALIDATOR
-ALTER SEQUENCE: missing AS
-ALTER VIEW: no completion after ALTER COLUMN column_name
-ALTER TRANSFORM: no doc for ALTER TRANSFORM, so I excluded TRANSFORM
from ALTER tab completion

I made a patch for this, so please have a look.

Best wishes,

--
Ken Kato
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

Attachments:

alter_tab_completion.patchtext/x-diff; name=alter_tab_completion.patchDownload+19-7
#2Michael Paquier
michael@paquier.xyz
In reply to: Ken Kato (#1)
Re: [PATCH] ALTER tab completion

On Fri, Nov 26, 2021 at 01:55:46PM +0900, Ken Kato wrote:

I noticed that there are some tab completions missing for the following
commands:
-ALTER DEFAULT PRIVILEGES: missing FOR USER

FOR ROLE is an equivalent. That does not seem mandatory to me.

-ALTER FOREIGN DATA WRAPPER: missing NO HANDLER, NO VALIDATOR

Okay for this one.

-ALTER VIEW: no completion after ALTER COLUMN column_name

+   /* ALTER VIEW xxx ALTER yyy */
+   else if (Matches("ALTER", "VIEW", MatchAny, "ALTER", MatchAny))
+       COMPLETE_WITH("SET DEFAULT", "DROP DEFAULT");
It may be cleaner to group this one with "ALTER VIEW xxx ALTER yyy"
two blocks above.

-ALTER TRANSFORM: no doc for ALTER TRANSFORM, so I excluded TRANSFORM from
ALTER tab completion

Right.

-ALTER SEQUENCE: missing AS

+   /* ALTER SEQUENCE <name> AS */
+   else if (TailMatches("ALTER", "SEQUENCE", MatchAny, "AS"))
+       COMPLETE_WITH("smallint", "integer", "bigint");
Re-quoting Horiguchi-san, that should be COMPLETE_WITH_CS() to keep
these completions in lower case.
--
Michael
#3Ken Kato
katouknl@oss.nttdata.com
In reply to: Michael Paquier (#2)
Re: [PATCH] ALTER tab completion

Hi,

Thank you for the comments!

I made following updates:

-ALTER DEFAULT PRIVILEGES: missing FOR USER

FOR ROLE is an equivalent. That does not seem mandatory to me.

I deleted the completion for "FOR USER".

-ALTER VIEW: no completion after ALTER COLUMN column_name

+   /* ALTER VIEW xxx ALTER yyy */
+   else if (Matches("ALTER", "VIEW", MatchAny, "ALTER", MatchAny))
+       COMPLETE_WITH("SET DEFAULT", "DROP DEFAULT");
It may be cleaner to group this one with "ALTER VIEW xxx ALTER yyy"
two blocks above.

I put them back to back so that it looks cleaner.

-ALTER SEQUENCE: missing AS

+   /* ALTER SEQUENCE <name> AS */
+   else if (TailMatches("ALTER", "SEQUENCE", MatchAny, "AS"))
+       COMPLETE_WITH("smallint", "integer", "bigint");
Re-quoting Horiguchi-san, that should be COMPLETE_WITH_CS() to keep
these completions in lower case.

That's what it's for.
I used COMPLETE_WITH_CS instead of COMPLETE_WITH.

Best wishes,

--
Ken Kato
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

Attachments:

alter_tab_completion.patchtext/x-diff; name=alter_tab_completion.patchDownload+17-5
#4Michael Paquier
michael@paquier.xyz
In reply to: Ken Kato (#3)
Re: [PATCH] ALTER tab completion

On Fri, Nov 26, 2021 at 05:00:44PM +0900, Ken Kato wrote:

I made following updates:

I have made one small modification for ALTER VIEW, and applied what
you have. Thanks, Kato-san.
--
Michael