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
This commit is contained in:
Michael Paquier 2022-08-15 14:08:59 +09:00
parent f2108d3bd0
commit f6c750d31d
1 changed files with 11 additions and 6 deletions

View File

@ -2516,6 +2516,17 @@ psql_completion(const char *text, int start, int end)
/* ALTER TYPE ALTER ATTRIBUTE <foo> */
else if (Matches("ALTER", "TYPE", MatchAny, "ALTER", "ATTRIBUTE", MatchAny))
COMPLETE_WITH("TYPE");
/* complete ALTER TYPE <sth> RENAME VALUE with list of enum values */
else if (Matches("ALTER", "TYPE", MatchAny, "RENAME", "VALUE"))
COMPLETE_WITH_ENUM_VALUE(prev3_wd);
/* ALTER TYPE <foo> SET */
else if (Matches("ALTER", "TYPE", MatchAny, "SET"))
COMPLETE_WITH("(", "SCHEMA");
/* complete ALTER TYPE <foo> SET ( with settable properties */
else if (Matches("ALTER", "TYPE", MatchAny, "SET", "("))
COMPLETE_WITH("ANALYZE", "RECEIVE", "SEND", "STORAGE", "SUBSCRIPT",
"TYPMOD_IN", "TYPMOD_OUT");
/* complete ALTER GROUP <foo> */
else if (Matches("ALTER", "GROUP", MatchAny))
COMPLETE_WITH("ADD USER", "DROP USER", "RENAME TO");
@ -2526,12 +2537,6 @@ psql_completion(const char *text, int start, int end)
else if (Matches("ALTER", "GROUP", MatchAny, "ADD|DROP", "USER"))
COMPLETE_WITH_QUERY(Query_for_list_of_roles);
/*
* If we have ALTER TYPE <sth> RENAME VALUE, provide list of enum values
*/
else if (Matches("ALTER", "TYPE", MatchAny, "RENAME", "VALUE"))
COMPLETE_WITH_ENUM_VALUE(prev3_wd);
/*
* ANALYZE [ ( option [, ...] ) ] [ table_and_columns [, ...] ]
* ANALYZE [ VERBOSE ] [ table_and_columns [, ...] ]