Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f6c750d

Browse files
committed
Improve tab completion of ALTER TYPE in psql
This commit adds support for more tab completion in this command as of "ALTER TYPE .. SET". The completion of "RENAME VALUE" was separated from the rest of the completions done for this command, so group everything together. Author: Vignesh C Discussion: https://postgr.es/m/CALDaNm1u83jtD2wysdw9XwokEacSXEyUpELajEvOMgJTc3pQ7g@mail.gmail.com
1 parent f2108d3 commit f6c750d

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/bin/psql/tab-complete.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2516,6 +2516,17 @@ psql_completion(const char *text, int start, int end)
25162516
/* ALTER TYPE ALTER ATTRIBUTE <foo> */
25172517
else if (Matches("ALTER", "TYPE", MatchAny, "ALTER", "ATTRIBUTE", MatchAny))
25182518
COMPLETE_WITH("TYPE");
2519+
/* complete ALTER TYPE <sth> RENAME VALUE with list of enum values */
2520+
else if (Matches("ALTER", "TYPE", MatchAny, "RENAME", "VALUE"))
2521+
COMPLETE_WITH_ENUM_VALUE(prev3_wd);
2522+
/* ALTER TYPE <foo> SET */
2523+
else if (Matches("ALTER", "TYPE", MatchAny, "SET"))
2524+
COMPLETE_WITH("(", "SCHEMA");
2525+
/* complete ALTER TYPE <foo> SET ( with settable properties */
2526+
else if (Matches("ALTER", "TYPE", MatchAny, "SET", "("))
2527+
COMPLETE_WITH("ANALYZE", "RECEIVE", "SEND", "STORAGE", "SUBSCRIPT",
2528+
"TYPMOD_IN", "TYPMOD_OUT");
2529+
25192530
/* complete ALTER GROUP <foo> */
25202531
else if (Matches("ALTER", "GROUP", MatchAny))
25212532
COMPLETE_WITH("ADD USER", "DROP USER", "RENAME TO");
@@ -2526,12 +2537,6 @@ psql_completion(const char *text, int start, int end)
25262537
else if (Matches("ALTER", "GROUP", MatchAny, "ADD|DROP", "USER"))
25272538
COMPLETE_WITH_QUERY(Query_for_list_of_roles);
25282539

2529-
/*
2530-
* If we have ALTER TYPE <sth> RENAME VALUE, provide list of enum values
2531-
*/
2532-
else if (Matches("ALTER", "TYPE", MatchAny, "RENAME", "VALUE"))
2533-
COMPLETE_WITH_ENUM_VALUE(prev3_wd);
2534-
25352540
/*
25362541
* ANALYZE [ ( option [, ...] ) ] [ table_and_columns [, ...] ]
25372542
* ANALYZE [ VERBOSE ] [ table_and_columns [, ...] ]

0 commit comments

Comments
 (0)