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