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 C721E2971E for ; Wed, 13 Mar 2019 13:03:21 -0400 (EDT) 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 Vg4wtFpbtNE1 for ; Wed, 13 Mar 2019 13:03:21 -0400 (EDT) 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 7AC7A296F2 for ; Wed, 13 Mar 2019 13:03:21 -0400 (EDT) From: imeevma@tarantool.org Subject: [tarantool-patches] [PATCH v4 6/8] sql: rework three errors of "unsupported" type Date: Wed, 13 Mar 2019 20:03:17 +0300 Message-Id: <5ca383b3205b2d97d8b6c88eed7fc3c4e33ad5fd.1552494059.git.imeevma@gmail.com> In-Reply-To: References: 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: korablev@tarantool.org Cc: tarantool-patches@freelists.org Three errors of "unsupported" type were reworked in this patch. Part of #3965 --- src/box/errcode.h | 1 + src/box/sql/analyze.c | 7 ++++--- src/box/sql/select.c | 10 ++++++---- test/box/misc.result | 1 + test/sql-tap/analyzeD.test.lua | 2 +- test/sql-tap/join.test.lua | 2 +- test/sql-tap/with1.test.lua | 2 +- 7 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/box/errcode.h b/src/box/errcode.h index d234d26..7764aa3 100644 --- a/src/box/errcode.h +++ b/src/box/errcode.h @@ -239,6 +239,7 @@ 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_SQL_ANALYZE_ARGUMENT, "ANALYZE statement argument %s is not a base table") \ /* * !IMPORTANT! Please follow instructions at start of the file diff --git a/src/box/sql/analyze.c b/src/box/sql/analyze.c index f95b34b..6ea598c 100644 --- a/src/box/sql/analyze.c +++ b/src/box/sql/analyze.c @@ -1121,9 +1121,10 @@ sqlAnalyze(Parse * pParse, Token * pName) struct space *sp = space_by_name(z); if (sp != NULL) { if (sp->def->opts.is_view) { - sqlErrorMsg(pParse, "VIEW isn't "\ - "allowed to be "\ - "analyzed"); + diag_set(ClientError, + ER_SQL_ANALYZE_ARGUMENT, + sp->def->name); + pParse->is_aborted = true; } else { vdbe_emit_analyze_table(pParse, sp); } diff --git a/src/box/sql/select.c b/src/box/sql/select.c index 9a8ea9d..e26b08b 100644 --- a/src/box/sql/select.c +++ b/src/box/sql/select.c @@ -407,8 +407,9 @@ sqlJoinType(Parse * pParse, Token * pA, Token * pB, Token * pC) jointype = JT_INNER; } else if ((jointype & JT_OUTER) != 0 && (jointype & (JT_LEFT | JT_RIGHT)) != JT_LEFT) { - sqlErrorMsg(pParse, - "RIGHT and FULL OUTER JOINs are not currently supported"); + diag_set(ClientError, ER_UNSUPPORTED, "Tarantool", + "RIGHT and FULL OUTER JOINs"); + pParse->is_aborted = true; jointype = JT_INNER; } return jointype; @@ -2465,8 +2466,9 @@ generateWithRecursiveQuery(Parse * pParse, /* Parsing context */ * the value for the recursive-table. Store the results in the Queue. */ if (p->selFlags & SF_Aggregate) { - sqlErrorMsg(pParse, - "recursive aggregate queries not supported"); + diag_set(ClientError, ER_UNSUPPORTED, "Tarantool", + "recursive aggregate queries"); + pParse->is_aborted = true; } else { p->pPrior = 0; sqlSelect(pParse, p, &destQueue); diff --git a/test/box/misc.result b/test/box/misc.result index 9f0b2c7..c350bbd 100644 --- a/test/box/misc.result +++ b/test/box/misc.result @@ -515,6 +515,7 @@ t; 184: box.error.SQL_UNRECOGNIZED_SYNTAX 185: box.error.SQL_UNKNOWN_TOKEN 186: box.error.SQL_PARSER_GENERIC + 187: box.error.SQL_ANALYZE_ARGUMENT ... test_run:cmd("setopt delimiter ''"); --- diff --git a/test/sql-tap/analyzeD.test.lua b/test/sql-tap/analyzeD.test.lua index 82ad7ff..1f00e80 100755 --- a/test/sql-tap/analyzeD.test.lua +++ b/test/sql-tap/analyzeD.test.lua @@ -177,7 +177,7 @@ test:do_catchsql_test( ANALYZE v; ]], { -- - 1, "VIEW isn't allowed to be analyzed" + 1, "ANALYZE statement argument V is not a base table" -- }) diff --git a/test/sql-tap/join.test.lua b/test/sql-tap/join.test.lua index df272a9..da29f77 100755 --- a/test/sql-tap/join.test.lua +++ b/test/sql-tap/join.test.lua @@ -480,7 +480,7 @@ test:do_catchsql_test( SELECT * FROM t1 NATURAL RIGHT OUTER JOIN t2; ]], { -- - 1, "RIGHT and FULL OUTER JOINs are not currently supported" + 1, "Tarantool does not support RIGHT and FULL OUTER JOINs" -- }) diff --git a/test/sql-tap/with1.test.lua b/test/sql-tap/with1.test.lua index add2345..16c9b12 100755 --- a/test/sql-tap/with1.test.lua +++ b/test/sql-tap/with1.test.lua @@ -1065,7 +1065,7 @@ test:do_catchsql_test(16.1, [[ SELECT * FROM i; ]], { -- <16.1> - 1, "recursive aggregate queries not supported" + 1, "Tarantool does not support recursive aggregate queries" -- }) -- 2.7.4