Skip to content

Commit bd40951

Browse files
committed
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
1 parent 626bfad commit bd40951

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/bin/psql/tab-complete.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3352,6 +3352,13 @@ psql_completion(const char *text, int start, int end)
33523352

33533353
COMPLETE_WITH_LIST(my_list);
33543354
}
3355+
else if (pg_strcasecmp(prev2_wd, "search_path") == 0)
3356+
{
3357+
COMPLETE_WITH_QUERY(Query_for_list_of_schemas
3358+
" AND nspname not like 'pg\\_toast%%' "
3359+
" AND nspname not like 'pg\\_temp%%' "
3360+
" UNION SELECT 'DEFAULT' ");
3361+
}
33553362
else
33563363
{
33573364
static const char *const my_list[] =

0 commit comments

Comments
 (0)