Skip to content

Commit 559e7a0

Browse files
committed
psql tab-complete for CREATE/DROP ACCESS METHOD
Alexander Korotkov
1 parent dabd255 commit 559e7a0

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/bin/psql/tab-complete.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,7 @@ typedef struct
877877
#define THING_NO_SHOW (THING_NO_CREATE | THING_NO_DROP)
878878

879879
static const pgsql_thing_t words_after_create[] = {
880+
{"ACCESS METHOD", NULL, NULL},
880881
{"AGGREGATE", NULL, &Query_for_list_of_aggregates},
881882
{"CAST", NULL, NULL}, /* Casts have complex structures for names, so
882883
* skip it */
@@ -1977,6 +1978,17 @@ psql_completion(const char *text, int start, int end)
19771978
COMPLETE_WITH_LIST5("HEADER", "QUOTE", "ESCAPE", "FORCE QUOTE",
19781979
"FORCE NOT NULL");
19791980

1981+
/* CREATE ACCESS METHOD */
1982+
/* Complete "CREATE ACCESS METHOD <name>" */
1983+
else if (Matches4("CREATE", "ACCESS", "METHOD", MatchAny))
1984+
COMPLETE_WITH_CONST("TYPE");
1985+
/* Complete "CREATE ACCESS METHOD <name> TYPE" */
1986+
else if (Matches5("CREATE", "ACCESS", "METHOD", MatchAny, "TYPE"))
1987+
COMPLETE_WITH_CONST("INDEX");
1988+
/* Complete "CREATE ACCESS METHOD <name> TYPE <type>" */
1989+
else if (Matches6("CREATE", "ACCESS", "METHOD", MatchAny, "TYPE", MatchAny))
1990+
COMPLETE_WITH_CONST("HANDLER");
1991+
19801992
/* CREATE DATABASE */
19811993
else if (Matches3("CREATE", "DATABASE", MatchAny))
19821994
COMPLETE_WITH_LIST9("OWNER", "TEMPLATE", "ENCODING", "TABLESPACE",
@@ -2263,6 +2275,7 @@ psql_completion(const char *text, int start, int end)
22632275
else if (Matches3("DROP",
22642276
"COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
22652277
MatchAny) ||
2278+
Matches4("DROP", "ACCESS", "METHOD", MatchAny) ||
22662279
(Matches4("DROP", "AGGREGATE|FUNCTION", MatchAny, MatchAny) &&
22672280
ends_with(prev_wd, ')')) ||
22682281
Matches4("DROP", "EVENT", "TRIGGER", MatchAny) ||

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy