aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2016-01-12 20:31:43 -0500
committerPeter Eisentraut <peter_e@gmx.net>2016-01-12 20:54:27 -0500
commitb1bfb28b586a319052d96dd4dfd40a05505ea6ed (patch)
tree285b97dfa4601db92eb47893f18cd0a19c43b9b7 /src
parentbc56d5898d1cbd9dee6fe16ea7a814a5820b6181 (diff)
downloadpostgresql-b1bfb28b586a319052d96dd4dfd40a05505ea6ed.tar.gz
postgresql-b1bfb28b586a319052d96dd4dfd40a05505ea6ed.zip
psql: Improve CREATE INDEX CONCURRENTLY tab completion
The completion of CREATE INDEX CONCURRENTLY was lacking in several ways compared to a plain CREATE INDEX command: - CREATE INDEX <name> ON completes table names, but didn't with CONCURRENTLY. - CREATE INDEX completes ON and existing index names, but with CONCURRENTLY it only completed ON. - CREATE INDEX <name> completes ON, but didn't with CONCURRENTLY. These are now all fixed.
Diffstat (limited to 'src')
-rw-r--r--src/bin/psql/tab-complete.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 52336aa96d1..878d4f07010 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -2005,15 +2005,17 @@ psql_completion(const char *text, int start, int end)
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_indexes,
" UNION SELECT 'ON'"
" UNION SELECT 'CONCURRENTLY'");
- /* Complete ... INDEX [<name>] ON with a list of tables */
- else if (TailMatches3("INDEX", MatchAny, "ON") ||
+ /* Complete ... INDEX|CONCURRENTLY [<name>] ON with a list of tables */
+ else if (TailMatches3("INDEX|CONCURRENTLY", MatchAny, "ON") ||
TailMatches2("INDEX|CONCURRENTLY", "ON"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tm, NULL);
- /* If we have CREATE|UNIQUE INDEX CONCURRENTLY, then add "ON" */
+ /* Complete ... INDEX CONCURRENTLY with "ON" and existing indexes */
else if (TailMatches2("INDEX", "CONCURRENTLY"))
- COMPLETE_WITH_CONST("ON");
- /* If we have CREATE|UNIQUE INDEX <sth>, then add "ON" */
- else if (TailMatches3("CREATE|UNIQUE", "INDEX", MatchAny))
+ COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_indexes,
+ " UNION SELECT 'ON'");
+ /* Complete CREATE|UNIQUE INDEX [CONCURRENTLY] <sth> with "ON" */
+ else if (TailMatches3("CREATE|UNIQUE", "INDEX", MatchAny) ||
+ TailMatches4("CREATE|UNIQUE", "INDEX", "CONCURRENTLY", MatchAny))
COMPLETE_WITH_CONST("ON");
/*