Skip site navigation (1) Skip section navigation (2)

Re: Tab completion for view triggers in psql

From: David Fetter <david(at)fetter(dot)org>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Cc: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Tab completion for view triggers in psql
Date: 2010-10-26 13:29:32
Message-ID: 20101026132932.GA2511@fetter.org (view raw or flat)
Thread:
Lists: pgsql-hackers
On Tue, Oct 26, 2010 at 12:35:13PM +0100, Dean Rasheed wrote:
> On 25 October 2010 21:01, David Fetter <david(at)fetter(dot)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(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david(dot)fetter(at)gmail(dot)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

In response to

pgsql-hackers by date

Next:From: Hitoshi HaradaDate: 2010-10-26 13:35:16
Subject: Re: Range Types, discrete and/or continuous
Previous:From: Shigeru HANADADate: 2010-10-26 13:22:56
Subject: Re: SQL/MED with simple wrappers

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group