Re: tab completion for setting search_path - Mailing list pgsql-hackers

From Andres Freund
Subject Re: tab completion for setting search_path
Date
Msg-id 20140503081133.GH12715@awork2.anarazel.de
Whole thread Raw
In response to Re: tab completion for setting search_path  (Jeff Janes <jeff.janes@gmail.com>)
Responses Re: tab completion for setting search_path
Re: tab completion for setting search_path
List pgsql-hackers
On 2014-05-03 00:13:45 -0700, Jeff Janes wrote:
> On Friday, May 2, 2014, Jeff Janes <jeff.janes@gmail.com> wrote:
> 
> > I've been working with an app that uses a schema name whose spelling is
> > hard to type, and the lack of tab completion for "SET search_path TO" was
> > bugging me.  So see attached.
> >
> > I filter out the system schemata, but not public.

That'd be nice.

> diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
> new file mode 100644
> index 6d26ffc..dec3d4a
> *** a/src/bin/psql/tab-complete.c
> --- b/src/bin/psql/tab-complete.c
> *************** psql_completion(const char *text, int st
> *** 3230,3235 ****
> --- 3230,3242 ----
>   
>               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\\_%%' "
> +                                 " AND nspname not like 'information_schema' "
> +                                 " UNION SELECT 'DEFAULT' ");
> +         }

Why should we exclude system schemata? That seems more likely to be
confusing than helpful? I can see a point in excluding another backend's
temp tables, but otherwise?

Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Sending out a request for more buildfarm animals?
Next
From: Andres Freund
Date:
Subject: Re: quiet inline configure check misses a step for clang