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

Re: Tab completion for view triggers in psql

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: David Fetter <david(at)fetter(dot)org>
Cc: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Tab completion for view triggers in psql
Date: 2010-10-26 11:35:13
Message-ID: AANLkTim94A_JWxRrjnD4AYJN02KPGZ1mMZo8Rvdqb_5A@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
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);
    }

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

Regards,
Dean


> 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
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>
>

In response to

Responses

pgsql-hackers by date

Next:From: Divakar SinghDate: 2010-10-26 11:44:28
Subject: Re: Postgres insert performance and storage requirement compared to Oracle
Previous:From: Itagaki TakahiroDate: 2010-10-26 09:23:37
Subject: Re: Extensible executor nodes for preparation of SQL/MED

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