Re: ALTER TEXT SEARCH DICTIONARY tab completion

2020-03-07 Thread Tom Lane
Georgios Kokolatos  writes:
> One minor nitpick I feel I should add is that for completeness and
> balance the equivalent `CREATE TEXT SEARCH DICTIONARY` should
> get the same treatment.

> Maybe something along the lines of:
> -   else if (Matches("CREATE", "TEXT", "SEARCH", "CONFIGURATION", 
> MatchAny))
> +   else if (Matches("CREATE", "TEXT", "SEARCH", 
> "DICTIONARY|CONFIGURATION", MatchAny))

Agreed; actually all four CREATE TEXT SEARCH commands could do that.
I pushed it as attached.

regards, tom lane

diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 54d0317..17b1f29 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -2140,7 +2140,7 @@ psql_completion(const char *text, int start, int end)
 	else if (Matches("ALTER", "TEXT", "SEARCH", "TEMPLATE|PARSER", MatchAny))
 		COMPLETE_WITH("RENAME TO", "SET SCHEMA");
 	else if (Matches("ALTER", "TEXT", "SEARCH", "DICTIONARY", MatchAny))
-		COMPLETE_WITH("OWNER TO", "RENAME TO", "SET SCHEMA");
+		COMPLETE_WITH("(", "OWNER TO", "RENAME TO", "SET SCHEMA");
 	else if (Matches("ALTER", "TEXT", "SEARCH", "CONFIGURATION", MatchAny))
 		COMPLETE_WITH("ADD MAPPING FOR", "ALTER MAPPING",
 	  "DROP MAPPING FOR",
@@ -2635,7 +2635,7 @@ psql_completion(const char *text, int start, int end)
 /* CREATE TEXT SEARCH */
 	else if (Matches("CREATE", "TEXT", "SEARCH"))
 		COMPLETE_WITH("CONFIGURATION", "DICTIONARY", "PARSER", "TEMPLATE");
-	else if (Matches("CREATE", "TEXT", "SEARCH", "CONFIGURATION", MatchAny))
+	else if (Matches("CREATE", "TEXT", "SEARCH", "CONFIGURATION|DICTIONARY|PARSER|TEMPLATE", MatchAny))
 		COMPLETE_WITH("(");
 
 /* CREATE SUBSCRIPTION */


Re: ALTER TEXT SEARCH DICTIONARY tab completion

2020-03-04 Thread Georgios Kokolatos
The following review has been posted through the commitfest application:
make installcheck-world:  not tested
Implements feature:   not tested
Spec compliant:   not tested
Documentation:not tested

It looks good and does what it says on the tin.

One minor nitpick I feel I should add is that for completeness and
balance the equivalent `CREATE TEXT SEARCH DICTIONARY` should 
get the same treatment.

Maybe something along the lines of:
-   else if (Matches("CREATE", "TEXT", "SEARCH", "CONFIGURATION", MatchAny))
+   else if (Matches("CREATE", "TEXT", "SEARCH", 
"DICTIONARY|CONFIGURATION", MatchAny))