Re: Tab completion for ALTER ... SET SCHEMA

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: Tab completion for ALTER ... SET SCHEMA
Дата
Msg-id AANLkTi=bg2Mbqy3dUQQV+82qTxr6nHwucRcpBL+px=d9@mail.gmail.com
обсуждение исходный текст
Ответ на Tab completion for ALTER ... SET SCHEMA  (andreas <andreas@proxel.se>)
Ответы Re: Tab completion for ALTER ... SET SCHEMA  (Andreas Karlsson <andreas@proxel.se>)
Список pgsql-hackers
On Fri, Dec 17, 2010 at 8:34 PM, andreas <andreas@proxel.se> wrote:
> It has annoys me every time I want to move a table to another schema
> that it completes to SET SCHEMA TO DEFAULT after a couple of presses of
> the tab key. So today I decided to get off my lazy ass to write a tiny
> patch to fix this behaviour. :)
>
> My first patch for PostgreSQL so a question: Should I add this to the
> open commitfest?

In general, yes, but before you do that...  the patch you've pasted
below doesn't implement the behavior you've described above.  Above,
you're describing removing a completion, but below, you're adding one.So I'm confused.

> ----
>
> *** a/src/bin/psql/tab-complete.c
> --- b/src/bin/psql/tab-complete.c
> *************** psql_completion(char *text, int start, i
> *** 1387,1392 ****
> --- 1387,1399 ----
>                         pg_strcasecmp(prev_wd, "USER") == 0)
>                COMPLETE_WITH_QUERY(Query_for_list_of_roles);
>
> +       /* ALTER <object> <name> SET SCHEMA */
> +       else if (pg_strcasecmp(prev4_wd, "ALTER") == 0 &&
> +                       pg_strcasecmp(prev2_wd, "SET") == 0  &&
> +                       pg_strcasecmp(prev_wd, "SCHEMA") == 0)
> +               COMPLETE_WITH_QUERY(Query_for_list_of_schemas);
> +
> +
>  /* BEGIN, END, ABORT */
>        else if (pg_strcasecmp(prev_wd, "BEGIN") == 0 ||
>                         pg_strcasecmp(prev_wd, "END") == 0 ||
>

Two other points:

1. ALTER TABLE and ALTER FUNCTION both seem to have completions for
this already, so maybe the above should be made specific to whatever
other object type you're concerned about.

2. Attaching the diff makes it much easier to extract than embedding
it in the body of the email.

Thanks,

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: unlogged tables vs. GIST
Следующее
От: Robert Haas
Дата:
Сообщение: Re: Why don't we accept exponential format for integers?