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 1C20C28BE6 for ; Sat, 2 Mar 2019 08:08:04 -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 Hws4pKmo-jnL for ; Sat, 2 Mar 2019 08:08:04 -0500 (EST) Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (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 CD3CF2779E for ; Sat, 2 Mar 2019 08:08:03 -0500 (EST) From: imeevma@tarantool.org Subject: [tarantool-patches] [PATCH v3 8/9] sql: rework three errors of "unsupported" type Date: Sat, 2 Mar 2019 16:08:02 +0300 Message-Id: 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 06f7a63..f2ea27a 100644 --- a/src/box/errcode.h +++ b/src/box/errcode.h @@ -246,6 +246,7 @@ struct errcode_record { /*191 */_(ER_HEX_LITERAL_MAX, "Hex literal %s%s length %d exceeds the supported limit (%d)") \ /*192 */_(ER_INT_LITERAL_MAX, "Integer literal %s%s exceeds the supported range %lld - %lld") \ /*193 */_(ER_SQL_PARSER_LIMIT, "%s%.*s %d exceeds the limit (%d)") \ + /*194 */_(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 9bcbe49..796c7bc 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 30ba947..261a8bd 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 2bb6613..6370592 100644 --- a/test/box/misc.result +++ b/test/box/misc.result @@ -522,6 +522,7 @@ t; 191: box.error.HEX_LITERAL_MAX 192: box.error.INT_LITERAL_MAX 193: box.error.SQL_PARSER_LIMIT + 194: 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 ce0d9e9..ef60609 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