Commit 4189e3d6 authored by Peter Eisentraut's avatar Peter Eisentraut

psql: Add completion support for DROP INDEX CONCURRENTLY

based on patch by Kyotaro Horiguchi
parent cf7dfbf2
...@@ -2009,8 +2009,8 @@ psql_completion(const char *text, int start, int end) ...@@ -2009,8 +2009,8 @@ psql_completion(const char *text, int start, int end)
else if (TailMatches3("INDEX|CONCURRENTLY", MatchAny, "ON") || else if (TailMatches3("INDEX|CONCURRENTLY", MatchAny, "ON") ||
TailMatches2("INDEX|CONCURRENTLY", "ON")) TailMatches2("INDEX|CONCURRENTLY", "ON"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tm, NULL); COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tm, NULL);
/* Complete ... INDEX CONCURRENTLY with "ON" and existing indexes */ /* Complete CREATE|UNIQUE INDEX CONCURRENTLY with "ON" and existing indexes */
else if (TailMatches2("INDEX", "CONCURRENTLY")) else if (TailMatches3("CREATE|UNIQUE", "INDEX", "CONCURRENTLY"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_indexes, COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_indexes,
" UNION SELECT 'ON'"); " UNION SELECT 'ON'");
/* Complete CREATE|UNIQUE INDEX [CONCURRENTLY] <sth> with "ON" */ /* Complete CREATE|UNIQUE INDEX [CONCURRENTLY] <sth> with "ON" */
...@@ -2247,7 +2247,7 @@ psql_completion(const char *text, int start, int end) ...@@ -2247,7 +2247,7 @@ psql_completion(const char *text, int start, int end)
/* DROP */ /* DROP */
/* Complete DROP object with CASCADE / RESTRICT */ /* Complete DROP object with CASCADE / RESTRICT */
else if (Matches3("DROP", else if (Matches3("DROP",
"COLLATION|CONVERSION|DOMAIN|EXTENSION|INDEX|LANGUAGE|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW", "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
MatchAny) || MatchAny) ||
(Matches4("DROP", "AGGREGATE|FUNCTION", MatchAny, MatchAny) && (Matches4("DROP", "AGGREGATE|FUNCTION", MatchAny, MatchAny) &&
ends_with(prev_wd, ')')) || ends_with(prev_wd, ')')) ||
...@@ -2265,6 +2265,17 @@ psql_completion(const char *text, int start, int end) ...@@ -2265,6 +2265,17 @@ psql_completion(const char *text, int start, int end)
else if (Matches2("DROP", "FOREIGN")) else if (Matches2("DROP", "FOREIGN"))
COMPLETE_WITH_LIST2("DATA WRAPPER", "TABLE"); COMPLETE_WITH_LIST2("DATA WRAPPER", "TABLE");
/* DROP INDEX */
else if (Matches2("DROP", "INDEX"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_indexes,
" UNION SELECT 'CONCURRENTLY'");
else if (Matches3("DROP", "INDEX", "CONCURRENTLY"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_indexes, NULL);
else if (Matches3("DROP", "INDEX", MatchAny))
COMPLETE_WITH_LIST2("CASCADE", "RESTRICT");
else if (Matches4("DROP", "INDEX", "CONCURRENTLY", MatchAny))
COMPLETE_WITH_LIST2("CASCADE", "RESTRICT");
/* DROP MATERIALIZED VIEW */ /* DROP MATERIALIZED VIEW */
else if (Matches2("DROP", "MATERIALIZED")) else if (Matches2("DROP", "MATERIALIZED"))
COMPLETE_WITH_CONST("VIEW"); COMPLETE_WITH_CONST("VIEW");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment