From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id DDB5A2690E for ; Tue, 26 Feb 2019 08:12:21 -0500 (EST) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wV7qeBORUS-T for ; Tue, 26 Feb 2019 08:12:21 -0500 (EST) Received: from smtp34.i.mail.ru (smtp34.i.mail.ru [94.100.177.94]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 99062268C5 for ; Tue, 26 Feb 2019 08:12:21 -0500 (EST) Date: Tue, 26 Feb 2019 16:12:17 +0300 From: Konstantin Osipov Subject: [tarantool-patches] Re: [PATCH v2 2/5] sql: rework syntax errors Message-ID: <20190226131217.GH5592@chai> References: <20190226082405.GA2696@chai> <8042E409-CC3B-42D5-9255-FE3E6ED8B517@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <8042E409-CC3B-42D5-9255-FE3E6ED8B517@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: "n.pettik" Cc: tarantool-patches@freelists.org, Imeev Mergen * n.pettik [19/02/26 16:02]: > > Yes, the name is suggested by me. There is a name clash with a > > generic ER_SYNTAX_ERROR. > > I don’t see problem here. First error is “Syntax error in %s : %s”. > For instance, “Syntax error in trigger body : blah-blah”. > Second one is “Syntax error near %s” or “Syntax error near %s token”. > For instance, “Syntax error near “create” token.” > Ok, if you still want to use ’syntax’ word, then at least let’s use > this variant: “Incorrect syntax near %s" > > I failed to find any compiler or db which generate > “Unrecognized syntax …” error messages. Ok, if you ask me what's better - syntax error vs. unrecognized syntax - up to you, it doesn't really matter. Let's ensure two properties: - the grammar and punctuation are correct - the message is as specific as possible, i.e. allows the user to easily identify location of the error. Don't assume there is a single-line statement, assume 1 select statement can easily be 200 lines of highly nested code. > > > I also requested to add line/character > > numbers to the error message, which I don't see in the patch. > > Line is useless now, we don’t have multi-line processing. We do. tarantool> box.sql.execute("select\n\n\n1") --- - - [1] ... -- Konstantin Osipov, Moscow, Russia, +7 903 626 22 32 http://tarantool.io - www.twitter.com/kostja_osipov