Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aC8U6-00047S-1h for pgsql-bugs@arkaria.postgresql.org; Thu, 24 Dec 2015 16:11:22 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aC8U5-0006iF-GD for pgsql-bugs@arkaria.postgresql.org; Thu, 24 Dec 2015 16:11:21 +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 1aC8U3-0006ht-R5 for pgsql-bugs@postgresql.org; Thu, 24 Dec 2015 16:11:19 +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 1aC8U0-0000Sf-13 for pgsql-bugs@postgresql.org; Thu, 24 Dec 2015 16:11:19 +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 tBOGBD33001420; Thu, 24 Dec 2015 11:11:13 -0500 From: Tom Lane To: tdhutt@gmail.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #13832: Syntax errors are extremely unfriendly In-reply-to: <20151224104428.2673.7170@wrigleys.postgresql.org> References: <20151224104428.2673.7170@wrigleys.postgresql.org> Comments: In-reply-to tdhutt@gmail.com message dated "Thu, 24 Dec 2015 10:44:28 +0000" Date: Thu, 24 Dec 2015 11:11:13 -0500 Message-ID: <1419.1450973473@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 tdhutt@gmail.com writes: > When you have a syntax error in PostgreSQL (or MySQL for that matter) you > get a message like this: >> ERROR: syntax error at or near "FROM" >> Position: 8 > This is not very user-friendly to put it mildly! Well, at least some of that is on the head of whatever client-side software you're using. psql, for example, produces an error cursor like this: regression=# select * from from tab; ERROR: syntax error at or near "from" LINE 1: select * from from tab; ^ > Compare this with Clang's > error messages (http://clang.llvm.org/diagnostics.html) which give you the > exact location of the error, and also what was expected, and even > suggestions to fix it! 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, eg in PG 9.5 you might get something like this for a misspelled column name: regression=# select unnique1 from tenk1; ERROR: column "unnique1" does not exist LINE 1: select unnique1 from tenk1; ^ HINT: Perhaps you meant to reference the column "tenk1.unique1". 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