aboutsummaryrefslogtreecommitdiff
path: root/src/bin/psql/tab-complete.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/psql/tab-complete.c')
-rw-r--r--src/bin/psql/tab-complete.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index dfcb66ba6de..5a4fd5c8731 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -3707,10 +3707,15 @@ psql_completion(const char *text, int start, int end)
COMPLETE_WITH_LIST_CS(my_list);
}
else if (strcmp(prev_wd, "\\connect") == 0 || strcmp(prev_wd, "\\c") == 0)
- COMPLETE_WITH_QUERY(Query_for_list_of_databases);
+ {
+ if (!recognized_connection_string(text))
+ COMPLETE_WITH_QUERY(Query_for_list_of_databases);
+ }
else if (strcmp(prev2_wd, "\\connect") == 0 || strcmp(prev2_wd, "\\c") == 0)
- COMPLETE_WITH_QUERY(Query_for_list_of_roles);
-
+ {
+ if (!recognized_connection_string(prev_wd))
+ COMPLETE_WITH_QUERY(Query_for_list_of_roles);
+ }
else if (strncmp(prev_wd, "\\da", strlen("\\da")) == 0)
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_aggregates, NULL);
else if (strncmp(prev_wd, "\\db", strlen("\\db")) == 0)