Re: EXECUTE tab completion

From: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andreas Karlsson <andreas(at)proxel(dot)se>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: EXECUTE tab completion
Date: 2011-10-20 02:50:58
Message-ID: CAK3UJRHJE120dAD7=2fSqbPGmomLuZT+944=E3t0AiDDLer3qg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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)

and the patch does seem to auto-complete a beginning EXECUTE
correctly. We could probably use a comment somewhere explaining this
quirk.

Josh

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dan Ports 2011-10-20 03:07:03 Re: Update on documentation builds on OSX w/ macports
Previous Message Tom Lane 2011-10-20 02:40:25 Re: EXECUTE tab completion