diff options
author | Michael Paquier | 2022-08-15 05:08:59 +0000 |
---|---|---|
committer | Michael Paquier | 2022-08-15 05:08:59 +0000 |
commit | f6c750d31d97a66a90e3389ae6832bf99cd15f30 (patch) | |
tree | 0db9e87c0972650d4a09fae001fa39f5d47a89dd /src | |
parent | f2108d3bd03d3cb101a8ddfa5fe127d30e7f47f4 (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/psql/tab-complete.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index f265e043e95..62a39779b9d 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -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 [, ...] ] |