Re: psql tab completion for SELECT - Mailing list pgsql-hackers

From Tom Lane
Subject Re: psql tab completion for SELECT
Date
Msg-id 14581.1328890968@sss.pgh.pa.us
Whole thread Raw
In response to Re: psql tab completion for SELECT  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: psql tab completion for SELECT  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Fri, Feb 10, 2012 at 11:01 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Well, if you want a patch with low standards, what about tab-completing
>> function names anywhere that we do not see context suggesting something
>> else?

> I think that without a bit more contextual information that's likely
> to lead to some odd results.  Unimplemented completions will lead to
> bizarre things happening.

True.  I was first thinking of doing this only if we know we're in
a DML query, ie *first* word on the line is
WITH/SELECT/INSERT/UPDATE/DELETE.  However, in the current
implementation that is not terribly workable because we are only looking
at the current line of text, not the whole input buffer; so making such
a restriction would disable completion after the first line of a multi-
line command.

> One thing that's been bugging me for a while is that the tab
> completion code all works by looking backward up to n words.

Yup.  At the very least it would be good if it had access to the entire
current command, so that we could sanity-check on the basis of the first
word.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Upcoming PG back-branch releases, end of this month
Next
From: Robert Haas
Date:
Subject: Re: psql tab completion for SELECT