Re: Tab completion for view triggers in psql

Поиск
Список
Период
Сортировка
От David Fetter
Тема Re: Tab completion for view triggers in psql
Дата
Msg-id 20101026132932.GA2511@fetter.org
обсуждение исходный текст
Ответ на Re: Tab completion for view triggers in psql  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Список pgsql-hackers
On Tue, Oct 26, 2010 at 12:35:13PM +0100, Dean Rasheed wrote:
> On 25 October 2010 21:01, David Fetter <david@fetter.org> wrote:
> > Folks,
> >
> > Please find attached patch for $subject :)
> >
>
> Thanks for looking at this. I forgot about tab completion.
>
> I think that the change to ALTER TRIGGER is not necessary. AFAICT it
> works OK unmodified. In fact, the modified code here:
>
> *** 971,977 **** psql_completion(char *text, int start, int end)
>       else if (pg_strcasecmp(prev4_wd, "ALTER") == 0 &&
>                pg_strcasecmp(prev3_wd, "TRIGGER") == 0 &&
>                pg_strcasecmp(prev_wd, "ON") == 0)
> !         COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables, NULL);
>
>       /* ALTER TRIGGER <name> ON <name> */
>       else if (pg_strcasecmp(prev4_wd, "TRIGGER") == 0 &&
> --- 1055,1061 ----
>       else if (pg_strcasecmp(prev4_wd, "ALTER") == 0 &&
>                pg_strcasecmp(prev3_wd, "TRIGGER") == 0 &&
>                pg_strcasecmp(prev_wd, "ON") == 0)
> !         COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_writeables, NULL);
>
>       /* ALTER TRIGGER <name> ON <name> */
>       else if (pg_strcasecmp(prev4_wd, "TRIGGER") == 0 &&
>
> appears to be unreachable, because it is preceded by
>
>     else if (pg_strcasecmp(prev4_wd, "ALTER") == 0 &&
>              pg_strcasecmp(prev3_wd, "TRIGGER") == 0)
>     {
>         completion_info_charp = prev2_wd;
>         COMPLETE_WITH_QUERY(Query_for_list_of_tables_for_trigger);
>     }

It is indeed unreachable.

> which works for tables and views, and makes the next "elseif"
> impossible to satisfy.  So I think that block could just be deleted,
> right?

Yes.  Good catch.  New patch attached :)

Cheers,
David.
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

Вложения

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

Предыдущее
От: Shigeru HANADA
Дата:
Сообщение: Re: SQL/MED with simple wrappers
Следующее
От: Hitoshi Harada
Дата:
Сообщение: Re: Range Types, discrete and/or continuous