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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Attachment Content-Type Size
psql_view_trigger_tab_completion_2.diff text/plain 10.6 KB

In response to

Browse pgsql-hackers by date

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