Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aDe1q-000318-Ut for pgsql-bugs@arkaria.postgresql.org; Mon, 28 Dec 2015 20:04:27 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aDe1q-0000RV-GR for pgsql-bugs@arkaria.postgresql.org; Mon, 28 Dec 2015 20:04:26 +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 1aDe1E-0008C9-C2 for pgsql-bugs@postgresql.org; Mon, 28 Dec 2015 20:03:48 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aDe1A-0003lt-Lr for pgsql-bugs@postgresql.org; Mon, 28 Dec 2015 20:03:47 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id tBSK3ghY024517; Mon, 28 Dec 2015 15:03:42 -0500 From: Tom Lane To: Tim Hutt cc: pgsql-bugs@postgresql.org Subject: Re: BUG #13832: Syntax errors are extremely unfriendly In-reply-to: References: <20151224104428.2673.7170@wrigleys.postgresql.org> <1419.1450973473@sss.pgh.pa.us> Comments: In-reply-to Tim Hutt message dated "Thu, 24 Dec 2015 18:06:14 +0000" Date: Mon, 28 Dec 2015 15:03:42 -0500 Message-ID: <24516.1451333022@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-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Tim Hutt writes: > On 24 Dec 2015 16:11, "Tom Lane" wrote: >> As far as raw syntax errors go, we're pretty much limited by what Bison >> will do; we're unlikely to implement our own parser from scratch just >> to improve this. We do go to considerable lengths for semantic errors... > Ah OK I guess this is an issue with Bison - theoretically it should be able > to say what it expects when it gets an invalid token right? You would think. I've experimented with Bison's %error-verbose directive, but if anything its results are worse than doing nothing: it seems to mention only a rather randomly-chosen subset of the possible continuations. (That seems to be related to their decision to put a fairly small hard limit on the length of their error messages, but even allowing for that, what you get seems pretty random.) It's also depressingly concrete; instead of something useful like "expected a table name here", you get "expected IDENT or ABORT or ABSOLUTE or (all possible unreserved keywords...) here", or at least that's what you would get if not for the aforesaid problem. There's been some recent chat in the PG mailing lists about whether we could extract tab-completion logic from the grammar specification, which is sort of related to this issue. We've not gotten far with that idea unfortunately. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs