Commit 559e7a0a authored by Teodor Sigaev's avatar Teodor Sigaev

psql tab-complete for CREATE/DROP ACCESS METHOD

Alexander Korotkov
parent dabd255d
......@@ -877,6 +877,7 @@ typedef struct
#define THING_NO_SHOW (THING_NO_CREATE | THING_NO_DROP)
static const pgsql_thing_t words_after_create[] = {
{"ACCESS METHOD", NULL, NULL},
{"AGGREGATE", NULL, &Query_for_list_of_aggregates},
{"CAST", NULL, NULL}, /* Casts have complex structures for names, so
* skip it */
......@@ -1977,6 +1978,17 @@ psql_completion(const char *text, int start, int end)
COMPLETE_WITH_LIST5("HEADER", "QUOTE", "ESCAPE", "FORCE QUOTE",
"FORCE NOT NULL");
/* CREATE ACCESS METHOD */
/* Complete "CREATE ACCESS METHOD <name>" */
else if (Matches4("CREATE", "ACCESS", "METHOD", MatchAny))
COMPLETE_WITH_CONST("TYPE");
/* Complete "CREATE ACCESS METHOD <name> TYPE" */
else if (Matches5("CREATE", "ACCESS", "METHOD", MatchAny, "TYPE"))
COMPLETE_WITH_CONST("INDEX");
/* Complete "CREATE ACCESS METHOD <name> TYPE <type>" */
else if (Matches6("CREATE", "ACCESS", "METHOD", MatchAny, "TYPE", MatchAny))
COMPLETE_WITH_CONST("HANDLER");
/* CREATE DATABASE */
else if (Matches3("CREATE", "DATABASE", MatchAny))
COMPLETE_WITH_LIST9("OWNER", "TEMPLATE", "ENCODING", "TABLESPACE",
......@@ -2263,6 +2275,7 @@ psql_completion(const char *text, int start, int end)
else if (Matches3("DROP",
"COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
MatchAny) ||
Matches4("DROP", "ACCESS", "METHOD", MatchAny) ||
(Matches4("DROP", "AGGREGATE|FUNCTION", MatchAny, MatchAny) &&
ends_with(prev_wd, ')')) ||
Matches4("DROP", "EVENT", "TRIGGER", MatchAny) ||
......
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