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 6AAC523ECC for ; Tue, 5 Mar 2019 04:07:08 -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 2VjOxEocsqVq for ; Tue, 5 Mar 2019 04:07:08 -0500 (EST) Received: from smtp59.i.mail.ru (smtp59.i.mail.ru [217.69.128.39]) (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 224ED20210 for ; Tue, 5 Mar 2019 04:07:08 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Subject: [tarantool-patches] Re: [PATCH v3 6/9] sql: rework six syntax errors From: "n.pettik" In-Reply-To: <80be508ddcba4ffe5f5f4e99068ccce61e05a764.1551530224.git.imeevma@gmail.com> Date: Tue, 5 Mar 2019 12:07:06 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <3C6CDD11-D7C7-42E4-8BAC-77E23DE6C48B@tarantool.org> References: <80be508ddcba4ffe5f5f4e99068ccce61e05a764.1551530224.git.imeevma@gmail.com> 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: tarantool-patches@freelists.org Cc: Imeev Mergen > On 2 Mar 2019, at 16:07, imeevma@tarantool.org wrote: >=20 > This patch rewords six more syntax errors. Are these errors considered to be syntax? AFAIR we=E2=80=99ve classified them as semantic errors. And I counted only three new error (and two changed tests) codes in errcode.h > Part of #3965 > --- > src/box/errcode.h | 3 +++ > src/box/sql/build.c | 4 +-- > src/box/sql/resolve.c | 62 = +++++++++++++++++++++---------------------- > test/box/misc.result | 3 +++ > test/sql-tap/check.test.lua | 2 +- > test/sql-tap/colname.test.lua | 2 +- > 6 files changed, 40 insertions(+), 36 deletions(-) >=20 > diff --git a/src/box/errcode.h b/src/box/errcode.h > index d234d26..057a6d3 100644 > --- a/src/box/errcode.h > +++ b/src/box/errcode.h > @@ -239,6 +239,9 @@ struct errcode_record { > /*184 */_(ER_SQL_UNRECOGNIZED_SYNTAX, "Syntax error near = '%.*s'") \ > /*185 */_(ER_SQL_UNKNOWN_TOKEN, "Syntax error: = unrecognized token: '%.*s'") \ > /*186 */_(ER_SQL_PARSER_GENERIC, "%s") \ > + /*187 */_(ER_INDEX_DEF, "%s prohibited in an = index definition") \ > + /*188 */_(ER_CHECK_CONSTRAINT_DEF, "%s prohibited in = prohibited in a CHECK constraint definition") \ Prohibited in prohibited? I guess this is typo. > + /*189 */_(ER_PRIMARY_KEY_DEF, "Expressions are = prohibited in a primary key definition") \ Make errcodes names be more specific: ER_INDEX_DEF -> ER_INDEX_EXPR_UNSUPPORTED etc. > diff --git a/src/box/sql/resolve.c b/src/box/sql/resolve.c > index 3215db3..02eca37 100644 > --- a/src/box/sql/resolve.c > +++ b/src/box/sql/resolve.c > @@ -510,30 +510,6 @@ sqlCreateColumnExpr(sql * db, SrcList * pSrc, int = iSrc, int iCol) > } >=20 > -/* > * Expression p should encode a floating point value between 1.0 and = 0.0. > * Return 1024 times this value. Or return -1 if p is not a floating = point > * value between 1.0 and 0.0. > @@ -605,7 +581,10 @@ resolveExprStep(Walker * pWalker, Expr * pExpr) > Expr *pRight; >=20 > /* if( pSrcList=3D=3D0 ) break; */ > - notValid(pParse, pNC, "the \".\" operator", = NC_IdxExpr); > + if (pNC->ncFlags & NC_IdxExpr) { > + diag_set(ClientError, ER_INDEX_DEF, "'.' = operator is"); > + pParse->is_aborted =3D true; > + } Is this code reachable? I don=E2=80=99t see any tests connected with it. Please, figure out whether these errors can be raised or not, and if they can be raised, add corresponding tests. > test_run:cmd("setopt delimiter ''"); > --- > diff --git a/test/sql-tap/check.test.lua b/test/sql-tap/check.test.lua > index 0d8bf15..e1d2d48 100755 > --- a/test/sql-tap/check.test.lua > +++ b/test/sql-tap/check.test.lua > @@ -319,7 +319,7 @@ test:do_catchsql_test( > ); > ]], { > -- > - 1, "Failed to create space 'T3': subqueries prohibited in = CHECK constraints" > + 1, "Failed to create space 'T3': Subqueries are prohibited in = prohibited in a CHECK constraint definition" > -- > }) >=20 > diff --git a/test/sql-tap/colname.test.lua = b/test/sql-tap/colname.test.lua > index 29fdf13..77c4280 100755 > --- a/test/sql-tap/colname.test.lua > +++ b/test/sql-tap/colname.test.lua > @@ -637,7 +637,7 @@ test:do_test( > test:do_catchsql_test( > "colname-11.1", > [[ create table t1(a INT, b INT, c INT, primary key('A'))]], > - {1, "expressions prohibited in PRIMARY KEY"}) > + {1, "Expressions are prohibited in a primary key definition=E2=80=9D= } Ok, I see three new error codes and two changed tests.