Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZpO9N-0004wp-ID for pgsql-hackers@arkaria.postgresql.org; Thu, 22 Oct 2015 22:15:57 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZpO9N-0004Zd-4I for pgsql-hackers@arkaria.postgresql.org; Thu, 22 Oct 2015 22:15:57 +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) (envelope-from ) id 1ZpO82-0001iU-44 for pgsql-hackers@postgresql.org; Thu, 22 Oct 2015 22:14:34 +0000 Received: from 173-164-140-181-sfba.hfc.comcastbusiness.net ([173.164.140.181] helo=fetter.org) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZpO7z-0002iq-1f for pgsql-hackers@postgresql.org; Thu, 22 Oct 2015 22:14:33 +0000 Received: by fetter.org (Postfix, from userid 500) id 5D7A8645B0; Thu, 22 Oct 2015 15:14:25 -0700 (PDT) Date: Thu, 22 Oct 2015 15:14:25 -0700 From: David Fetter To: Tom Lane Cc: Robert Haas , Thomas Munro , Jeff Janes , Alvaro Herrera , Pg Hackers Subject: Re: Making tab-complete.c easier to maintain Message-ID: <20151022221425.GB22539@fetter.org> References: <17081.1441374043@sss.pgh.pa.us> <20150907135605.GP2912@alvherre.pgsql> <51382.1445549813@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51382.1445549813@sss.pgh.pa.us> User-Agent: Mutt/1.5.24 (2015-08-30) X-Pg-Spam-Score: -0.9 (/) 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 Thu, Oct 22, 2015 at 02:36:53PM -0700, Tom Lane wrote: > Robert Haas writes: > > On Wed, Oct 21, 2015 at 8:54 PM, Thomas Munro > > wrote: > >> (Apologies for sending so many versions. tab-complete.c keeps moving > >> and I want to keep a version that applies on top of master out there, > >> for anyone interested in looking at this. As long as no one objects > >> and there is interest in the patch, I'll keep doing that.) > > > I don't want to rain on the parade since other people seem to like > > this, but I'm sort of unimpressed by this. Yes, it removes >1000 > > lines of code, and that's not nothing. But it's all mechanical code, > > so, not to be dismissive, but who really cares? Is it really worth > > replacing the existing notation that we all know with a new one that > > we have to learn? I'm not violently opposed if someone else wants to > > commit this, but I'm unexcited about it. > > What I would like is to find a way to auto-generate basically this entire > file from gram.y. I've been hoping we could use a principled approach for years. My fondest hope along that line would also involve catalog access, so it could correctly tab-complete user-defined things, but I have the impression that the catalog access variant is "much later" even if autogeneration from gram.y is merely "soon." I'd love to be wrong about that. > That would imply going over to something at least > somewhat parser-based, instead of the current way that is more or less > totally ad-hoc. That would be a very good thing though, because the > current way gives wrong answers not-infrequently, even discounting cases > that it's simply not been taught about. Indeed. > I have no very good idea how to do that, though. Bison does have a > notion of which symbols are possible as the next symbol at any given > parse point, but it doesn't really make that accessible. There's a lack > of cooperation on the readline side too: we'd need to be able to see the > whole query buffer not just the current line. This may be on point: http://stackoverflow.com/questions/161495/is-there-a-nice-way-of-handling-multi-line-input-with-gnu-readline I suspect we might have to stop pretending to support alternatives to libreadline if we went that direction, not that that would necessarily be a bad idea. Cheers, David. -- David Fetter http://fetter.org/ Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter Skype: davidfetter XMPP: david.fetter@gmail.com 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