aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Vondra <tomas.vondra@postgresql.org>2018-11-28 00:48:51 +0100
committerTomas Vondra <tomas.vondra@postgresql.org>2018-11-28 00:48:51 +0100
commitd1ce4ed2d56e42531581bb83e769a8840c591e15 (patch)
tree9a13510f67e20465b60e56947b7b872ed9c6daa2
parentd67dae036bd71afd2be7a2fafd7bc1ef38bfcdd1 (diff)
downloadpostgresql-d1ce4ed2d56e42531581bb83e769a8840c591e15.tar.gz
postgresql-d1ce4ed2d56e42531581bb83e769a8840c591e15.zip
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 121213d9d 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
-rw-r--r--src/bin/psql/tab-complete.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 7993c05283d..fa44b2820b5 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -2390,9 +2390,7 @@ psql_completion(const char *text, int start, int end)
COMPLETE_WITH("(", "ON");
else if (Matches("CREATE", "STATISTICS", MatchAny, "("))
COMPLETE_WITH("ndistinct", "dependencies");
- else if (HeadMatches("CREATE", "STATISTICS", MatchAny) &&
- previous_words[0][0] == '(' &&
- previous_words[0][strlen(previous_words[0]) - 1] == ')')
+ else if (Matches("CREATE", "STATISTICS", MatchAny, "(*)"))
COMPLETE_WITH("ON");
else if (HeadMatches("CREATE", "STATISTICS", MatchAny) &&
TailMatches("FROM"))