mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Improve psql tab completion for various DROP commands
The following improvements are done: - Handling of RESTRICT/CASCADE for DROP OWNED, matviews and policies. - Handling of DROP TRANSFORM This is a continuation of the work done in0cd6d3b
andf44ceb4
. Author: Ken Kato Reviewed-by: Asif Rehman Discussion: https://postgr.es/m/0fafb73f3a0c6bcec817a25ca9d5a853@oss.nttdata.com
This commit is contained in:
@ -3322,12 +3322,16 @@ psql_completion(const char *text, int start, int end)
|
||||
COMPLETE_WITH("VIEW");
|
||||
else if (Matches("DROP", "MATERIALIZED", "VIEW"))
|
||||
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_matviews, NULL);
|
||||
else if (Matches("DROP", "MATERIALIZED", "VIEW", MatchAny))
|
||||
COMPLETE_WITH("CASCADE", "RESTRICT");
|
||||
|
||||
/* DROP OWNED BY */
|
||||
else if (Matches("DROP", "OWNED"))
|
||||
COMPLETE_WITH("BY");
|
||||
else if (Matches("DROP", "OWNED", "BY"))
|
||||
COMPLETE_WITH_QUERY(Query_for_list_of_roles);
|
||||
else if (Matches("DROP", "OWNED", "BY", MatchAny))
|
||||
COMPLETE_WITH("CASCADE", "RESTRICT");
|
||||
|
||||
/* DROP TEXT SEARCH */
|
||||
else if (Matches("DROP", "TEXT", "SEARCH"))
|
||||
@ -3368,6 +3372,8 @@ psql_completion(const char *text, int start, int end)
|
||||
completion_info_charp = prev2_wd;
|
||||
COMPLETE_WITH_QUERY(Query_for_list_of_tables_for_policy);
|
||||
}
|
||||
else if (Matches("DROP", "POLICY", MatchAny, "ON", MatchAny))
|
||||
COMPLETE_WITH("CASCADE", "RESTRICT");
|
||||
|
||||
/* DROP RULE */
|
||||
else if (Matches("DROP", "RULE", MatchAny))
|
||||
@ -3380,6 +3386,21 @@ psql_completion(const char *text, int start, int end)
|
||||
else if (Matches("DROP", "RULE", MatchAny, "ON", MatchAny))
|
||||
COMPLETE_WITH("CASCADE", "RESTRICT");
|
||||
|
||||
/* DROP TRANSFORM */
|
||||
else if (Matches("DROP", "TRANSFORM"))
|
||||
COMPLETE_WITH("FOR");
|
||||
else if (Matches("DROP", "TRANSFORM", "FOR"))
|
||||
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_datatypes, NULL);
|
||||
else if (Matches("DROP", "TRANSFORM", "FOR", MatchAny))
|
||||
COMPLETE_WITH("LANGUAGE");
|
||||
else if (Matches("DROP", "TRANSFORM", "FOR", MatchAny, "LANGUAGE"))
|
||||
{
|
||||
completion_info_charp = prev2_wd;
|
||||
COMPLETE_WITH_QUERY(Query_for_list_of_languages);
|
||||
}
|
||||
else if (Matches("DROP", "TRANSFORM", "FOR", MatchAny, "LANGUAGE", MatchAny))
|
||||
COMPLETE_WITH("CASCADE", "RESTRICT");
|
||||
|
||||
/* EXECUTE */
|
||||
else if (Matches("EXECUTE"))
|
||||
COMPLETE_WITH_QUERY(Query_for_list_of_prepared_statements);
|
||||
|
Reference in New Issue
Block a user