Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eDydG-0003g3-TG for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Nov 2017 20:13:31 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1eDydF-0005Pk-MQ for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Nov 2017 20:13:29 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eDydE-0005OT-Ah for pgsql-hackers@postgresql.org; Sun, 12 Nov 2017 20:13:28 +0000 Received: from xvm-110-146.dc2.ghst.net ([46.226.110.146] helo=fetter.org) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eDydB-0005LO-4I for pgsql-hackers@postgresql.org; Sun, 12 Nov 2017 20:13:27 +0000 Received: by fetter.org (Postfix, from userid 1001) id 15E13401C6; Sun, 12 Nov 2017 21:13:23 +0100 (CET) Date: Sun, 12 Nov 2017 21:13:22 +0100 From: David Fetter To: Edmund Horner Cc: pgsql-hackers@postgresql.org Subject: Re: PATCH: psql tab completion for SELECT Message-ID: <20171112201322.GA16913@fetter.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org 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 won't find column bar. That can be fixed later. > Examples: > > postgres=# select rel > relacl relchecks relhasindex > relhassubclass (etc.) > > postgres=# select str > string_to_array( strip( strpos( Neat! Please add this to the upcoming (2018-01) commitfest at https://commitfest.postgresql.org/ Best, David. -- David Fetter 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