aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2014-07-12 15:44:39 +0200
committerAndres Freund <andres@anarazel.de>2014-07-12 15:44:39 +0200
commitbd409519bd19911d2d2cba64415447d2fa9d766b (patch)
tree9a8494f50c7e5af5f11bdfb078a123466ef49524
parent626bfad6cc5701eb385b8995e1431ad6a5f24928 (diff)
downloadpostgresql-bd409519bd19911d2d2cba64415447d2fa9d766b.tar.gz
postgresql-bd409519bd19911d2d2cba64415447d2fa9d766b.zip
Minimal psql tab completion support for SET search_path.
Complete SET search_path = ... to non-temporary and non-toast schemas. Since there pretty much is no use case to add those to the search path and there can be many it's helpful to exclude them. It'd be nicer to complete multiple search path elements, but that's not easy. Jeff Janes
-rw-r--r--src/bin/psql/tab-complete.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index c3a54d458a1..24e60b76091 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -3352,6 +3352,13 @@ psql_completion(const char *text, int start, int end)
COMPLETE_WITH_LIST(my_list);
}
+ else if (pg_strcasecmp(prev2_wd, "search_path") == 0)
+ {
+ COMPLETE_WITH_QUERY(Query_for_list_of_schemas
+ " AND nspname not like 'pg\\_toast%%' "
+ " AND nspname not like 'pg\\_temp%%' "
+ " UNION SELECT 'DEFAULT' ");
+ }
else
{
static const char *const my_list[] =