Skip to content

Commit 2ff5ca8

Browse files
committed
Add support for tab completion after ALTER EXTENSION ADD|DROP in psql
This appends the set of object types supported by these commands, and the objects defined in the cluster are completed after that. Note that these may not be in the extension being working on when using DROP, to keep the code simple, but this is much more useful than the previous behavior of not knowing the objects that can be touched. Author: Vignesh C Discussion: https://postgr.es/m/CALDaNm3LVM2QcUWqgOonKZH80TveT-tUthbw4ZhuE_6pD3yi-A@mail.gmail.com
1 parent af3855c commit 2ff5ca8

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/bin/psql/tab-complete.c

+21
Original file line numberDiff line numberDiff line change
@@ -1982,6 +1982,27 @@ psql_completion(const char *text, int start, int end)
19821982
else if (Matches("ALTER", "EXTENSION", MatchAny))
19831983
COMPLETE_WITH("ADD", "DROP", "UPDATE", "SET SCHEMA");
19841984

1985+
/* ALTER EXTENSION <name> ADD|DROP */
1986+
else if (Matches("ALTER", "EXTENSION", MatchAny, "ADD|DROP"))
1987+
COMPLETE_WITH("ACCESS METHOD", "AGGREGATE", "CAST", "COLLATION",
1988+
"CONVERSION", "DOMAIN", "EVENT TRIGGER", "FOREIGN",
1989+
"FUNCTION", "MATERIALIZED VIEW", "OPERATOR",
1990+
"LANGUAGE", "PROCEDURE", "ROUTINE", "SCHEMA",
1991+
"SEQUENCE", "SERVER", "TABLE", "TEXT SEARCH",
1992+
"TRANSFORM FOR", "TYPE", "VIEW");
1993+
1994+
/* ALTER EXTENSION <name> ADD|DROP FOREIGN */
1995+
else if (Matches("ALTER", "EXTENSION", MatchAny, "ADD|DROP", "FOREIGN"))
1996+
COMPLETE_WITH("DATA WRAPPER", "TABLE");
1997+
1998+
/* ALTER EXTENSION <name> ADD|DROP OPERATOR */
1999+
else if (Matches("ALTER", "EXTENSION", MatchAny, "ADD|DROP", "OPERATOR"))
2000+
COMPLETE_WITH("CLASS", "FAMILY");
2001+
2002+
/* ALTER EXTENSION <name> ADD|DROP TEXT SEARCH */
2003+
else if (Matches("ALTER", "EXTENSION", MatchAny, "ADD|DROP", "TEXT", "SEARCH"))
2004+
COMPLETE_WITH("CONFIGURATION", "DICTIONARY", "PARSER", "TEMPLATE");
2005+
19852006
/* ALTER EXTENSION <name> UPDATE */
19862007
else if (Matches("ALTER", "EXTENSION", MatchAny, "UPDATE"))
19872008
COMPLETE_WITH("TO");

0 commit comments

Comments
 (0)