Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZpOvE-0006hm-TA for pgsql-hackers@arkaria.postgresql.org; Thu, 22 Oct 2015 23:05:25 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZpOvE-0001aX-6b for pgsql-hackers@arkaria.postgresql.org; Thu, 22 Oct 2015 23:05:24 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZpOvD-0001aQ-DZ for pgsql-hackers@postgresql.org; Thu, 22 Oct 2015 23:05:23 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZpOv6-0001wW-Ie for pgsql-hackers@postgresql.org; Thu, 22 Oct 2015 23:05:22 +0000 Received: from pro.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id t9MN56Cw018302; Thu, 22 Oct 2015 19:05:07 -0400 From: Tom Lane To: David Fetter cc: Robert Haas , Thomas Munro , Jeff Janes , Alvaro Herrera , Pg Hackers Subject: Re: Making tab-complete.c easier to maintain In-reply-to: <20151022221425.GB22539@fetter.org> References: <17081.1441374043@sss.pgh.pa.us> <20150907135605.GP2912@alvherre.pgsql> <51382.1445549813@sss.pgh.pa.us> <20151022221425.GB22539@fetter.org> Comments: In-reply-to David Fetter message dated "Thu, 22 Oct 2015 15:14:25 -0700" Date: Thu, 22 Oct 2015 16:05:06 -0700 Message-ID: <53412.1445555106@sss.pgh.pa.us> X-Pg-Spam-Score: -1.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 David Fetter writes: > On Thu, Oct 22, 2015 at 02:36:53PM -0700, Tom Lane wrote: >> 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. Given the license issues around GNU readline, requiring it seems like probably a non-starter. It strikes me though that maybe we don't need readline's cooperation. I think it's already true that the previous lines of the query buffer are stashed somewhere that psql knows about, so in principle we could sew them together with the current line. That might be a project worth tackling on its own, since we could make the existing code smarter about multiline queries, whether or not we ever get to a grammar-based solution. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers