From: David Fetter <david@fetter.org>
To: Edmund Horner <ejrh00@gmail.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: PATCH: psql tab completion for SELECT
Date: Sun, 12 Nov 2017 21:13:22 +0100
Message-ID: <20171112201322.GA16913@fetter.org> (raw)
In-Reply-To: <CAMyN-kB_xrU4iYdcF1j=tijgO1DSyjtb3j96O4UEj91XZrZcMg@mail.gmail.com>
References: <CAMyN-kB_xrU4iYdcF1j=tijgO1DSyjtb3j96O4UEj91XZrZcMg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
On Mon, Nov 06, 2017 at 05:28:55PM +1300, Edmund Horner wrote:
> Hi pgsql-hackers,
>
> Here's a little draft patch to add *some* tab completion ability for
> SELECT in psql. I have often missed the ability, especially with
> invocations of utility functions.
>
> It would be nice to be able to suggest column names from the
> relevant tables in the query, but, as the SQL language puts the
> column list before the FROM clause, we have to use columns from all
> tables; I'm certainly not the first to be frustrated by this
> language feature, but we can't do much about it.
>
> What my patch does:
>
> For a command line with the single word SELECT, column names and
> function names will be used for completions of the next word.
> Function names have a "(" suffix added, largely because it makes
> them easier to distinguish in the completion list.
>
> Only the first select-list item can be tab-completed; i.e. SELECT
> foo, b<tab> won't find column bar.
That can be fixed later.
> Examples:
>
> postgres=# select rel<tab>
> relacl relchecks relhasindex
> relhassubclass (etc.)
>
> postgres=# select str<tab>
> string_to_array( strip( strpos(
Neat!
Please add this to the upcoming (2018-01) commitfest at
https://commitfest.postgresql.org/
Best,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778
Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: david@fetter.org, ejrh00@gmail.com
Subject: Re: PATCH: psql tab completion for SELECT
In-Reply-To: <20171112201322.GA16913@fetter.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox