Skip to content

Commit d1ce4ed

Browse files
committed
Use wildcard to match parens after CREATE STATISTICS
CREATE STATISTICS completion was checking manually for the start and end of the parenthesised list of types. That works, but we now have a better way to do that as commit 121213d taught word_matches() to allow '*' in the middle of an alternative. But it only applied that to tab completion for EXPLAIN, ANALYZE and VACUUM. Use it for CREATE STATISTICS too. Author: Dagfinn Ilmari Mannsåker Discussion: https://www.postgresql.org/message-id/flat/d8jwooziy1s.fsf%40dalvik.ping.uio.no
1 parent d67dae0 commit d1ce4ed

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/bin/psql/tab-complete.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2390,9 +2390,7 @@ psql_completion(const char *text, int start, int end)
23902390
COMPLETE_WITH("(", "ON");
23912391
else if (Matches("CREATE", "STATISTICS", MatchAny, "("))
23922392
COMPLETE_WITH("ndistinct", "dependencies");
2393-
else if (HeadMatches("CREATE", "STATISTICS", MatchAny) &&
2394-
previous_words[0][0] == '(' &&
2395-
previous_words[0][strlen(previous_words[0]) - 1] == ')')
2393+
else if (Matches("CREATE", "STATISTICS", MatchAny, "(*)"))
23962394
COMPLETE_WITH("ON");
23972395
else if (HeadMatches("CREATE", "STATISTICS", MatchAny) &&
23982396
TailMatches("FROM"))

0 commit comments

Comments
 (0)