From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
---|---|
To: | Josh Kupershmidt <schmiddy(at)gmail(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andreas Karlsson <andreas(at)proxel(dot)se>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: EXECUTE tab completion |
Date: | 2011-10-20 13:23:31 |
Message-ID: | 1319116019-sup-5356@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Excerpts from Josh Kupershmidt's message of mié oct 19 23:50:58 -0300 2011:
> On Wed, Oct 19, 2011 at 10:40 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > Josh Kupershmidt <schmiddy(at)gmail(dot)com> writes:
> >> Incidentally, I was wondering what the heck was up with a clause like this:
> >> else if (pg_strcasecmp(prev_wd, "EXECUTE") == 0 &&
> >> pg_strcasecmp(prev2_wd, "EXECUTE") == 0)
> >
> > Hmm, maybe || was meant not && ? It seems pretty unlikely that the
> > above test would ever trigger on valid SQL input.
>
> Well, changing '&&' to '||' breaks the stated comment of the patch, namely:
> /* must not match CREATE TRIGGER ... EXECUTE PROCEDURE */
>
> I assume this is an accepted quirk of previous_word() since we have
> this existing similar code:
>
> /* DROP, but watch out for DROP embedded in other commands */
> /* complete with something you can drop */
> else if (pg_strcasecmp(prev_wd, "DROP") == 0 &&
> pg_strcasecmp(prev2_wd, "DROP") == 0)
Maybe both are wrong, though the DROP case seems to work so maybe it's
just dead code. This was introduced in commit
90725929465474648de133d216b873bdb69fe357:
***************
*** 674,685 **** psql_completion(char *text, int start, int end)
else if (pg_strcasecmp(prev_wd, "CREATE") == 0)
matches = completion_matches(text, create_command_generator);
! /* DROP, except ALTER (TABLE|DOMAIN|GROUP) sth DROP */
/* complete with something you can drop */
else if (pg_strcasecmp(prev_wd, "DROP") == 0 &&
! pg_strcasecmp(prev3_wd, "TABLE") != 0 &&
! pg_strcasecmp(prev3_wd, "DOMAIN") != 0 &&
! pg_strcasecmp(prev3_wd, "GROUP") != 0)
matches = completion_matches(text, drop_command_generator);
/* ALTER */
--- 674,683 ----
else if (pg_strcasecmp(prev_wd, "CREATE") == 0)
matches = completion_matches(text, create_command_generator);
! /* DROP, but watch out for DROP embedded in other commands */
/* complete with something you can drop */
else if (pg_strcasecmp(prev_wd, "DROP") == 0 &&
! pg_strcasecmp(prev2_wd, "DROP") == 0)
matches = completion_matches(text, drop_command_generator);
/* ALTER */
--
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2011-10-20 14:36:43 | Re: EXECUTE tab completion |
Previous Message | Kevin Grittner | 2011-10-20 12:33:59 | Re: SSI implementation question |