Fix bogus tab-completion queries.

My (tgl's) thinko in commit 02b8048ba: I forgot that the first
argument of COMPLETE_WITH_QUERY_PLUS is a format string, and
hence failed to double a literal %.  These two places seem to
be the only ones that are wrong, though.

Vignesh C

Discussion: https://postgr.es/m/CALDaNm0hBO+tZqBWhBjTVxyET1GWANq5K9XpQ07atSxnFXbG7w@mail.gmail.com
This commit is contained in:
Tom Lane 2022-03-13 19:52:48 -04:00
parent 6e20f4600a
commit 369398ed88
1 changed files with 2 additions and 2 deletions

View File

@ -1811,7 +1811,7 @@ psql_completion(const char *text, int start, int end)
COMPLETE_WITH("(", "ALL TABLES IN SCHEMA", "TABLE");
else if (Matches("ALTER", "PUBLICATION", MatchAny, "ADD|DROP|SET", "ALL", "TABLES", "IN", "SCHEMA"))
COMPLETE_WITH_QUERY_PLUS(Query_for_list_of_schemas
" AND nspname NOT LIKE E'pg\\\\_%'",
" AND nspname NOT LIKE E'pg\\\\_%%'",
"CURRENT_SCHEMA");
/* ALTER PUBLICATION <name> SET ( */
else if (HeadMatches("ALTER", "PUBLICATION", MatchAny) && TailMatches("SET", "("))
@ -2956,7 +2956,7 @@ psql_completion(const char *text, int start, int end)
*/
else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "ALL", "TABLES", "IN", "SCHEMA"))
COMPLETE_WITH_QUERY_PLUS(Query_for_list_of_schemas
" AND nspname NOT LIKE E'pg\\\\_%'",
" AND nspname NOT LIKE E'pg\\\\_%%'",
"CURRENT_SCHEMA");
else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "ALL", "TABLES", "IN", "SCHEMA", MatchAny) && (!ends_with(prev_wd, ',')))
COMPLETE_WITH("WITH (");