Re: Patch: add psql tab completion for event triggers

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: Patch: add psql tab completion for event triggers
Дата
Msg-id CA+TgmoaQSgRf+YhQRDZzEcWw2d1nKe9qD=uu8hmR=2czgRLuTg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Patch: add psql tab completion for event triggers  (Ian Barwick <ian@2ndquadrant.com>)
Ответы Re: Patch: add psql tab completion for event triggers  (Ian Barwick <ian@2ndquadrant.com>)
Список pgsql-hackers
On Tue, Apr 8, 2014 at 5:27 AM, Ian Barwick <ian@2ndquadrant.com> wrote:
> On 08/04/14 18:22, Ian Barwick wrote:
>>
>> As it was kind of annoying not to have this when playing around with
>> event triggers.
>>
>> This also tightens up the existing tab completion for ALTER TRIGGER,
>> which contained redundant code for table name completion, and which was
>> also causing a spurious "RENAME TO" to be inserted in this context:
>>
>>      CREATE EVENT TRIGGER foo ON {event} ^I
>
>
> Apologies, previous patch had some unrelated changes in it.
>
> Correct patch attached.

This *still* has some unrelated things in it, like s/Pgsql/Postgres/,
and numerous hunks consisting entirely of whitespace changes and/or
changes to unrelated comments.

Also, what's the point of this hunk:

*************** psql_completion(const char *text, int st
*** 1318,1340 ****                        pg_strcasecmp(prev2_wd, "TRIGGER") == 0)
COMPLETE_WITH_CONST("ON");

-       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);
-       }
-       /*
!        * If we have ALTER TRIGGER <sth> ON, then add the correct tablename        */       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 &&                        pg_strcasecmp(prev2_wd, "ON") == 0)
            COMPLETE_WITH_CONST("RENAME TO");
 

--- 1355,1374 ----                        pg_strcasecmp(prev2_wd, "TRIGGER") == 0)
COMPLETE_WITH_CONST("ON");
       /*
!        * If we have ALTER TRIGGER <name> ON, then add the correct tablename        */       else if
(pg_strcasecmp(prev4_wd,"ALTER") == 0 &&                        pg_strcasecmp(prev3_wd, "TRIGGER") == 0 &&
         pg_strcasecmp(prev_wd, "ON") == 0)
 
!       {
!               completion_info_charp = prev2_wd;
!               COMPLETE_WITH_QUERY(Query_for_list_of_tables_for_trigger);
!       }
       /* ALTER TRIGGER <name> ON <name> */
!       else if (pg_strcasecmp(prev5_wd, "ALTER") == 0 &&
!                        pg_strcasecmp(prev4_wd, "TRIGGER") == 0 &&                        pg_strcasecmp(prev2_wd,
"ON")== 0)               COMPLETE_WITH_CONST("RENAME TO");
 



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



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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: default opclass for jsonb (was Re: Call for GIST/GIN/SP-GIST opclass documentation)
Следующее
От: Tom Lane
Дата:
Сообщение: Re: default opclass for jsonb (was Re: Call for GIST/GIN/SP-GIST opclass documentation)