Tarantool development patches archive
 help / color / mirror / Atom feed
From: imeevma@tarantool.org
To: korablev@tarantool.org
Cc: tarantool-patches@freelists.org
Subject: [tarantool-patches] [PATCH v3 8/9] sql: rework three errors of "unsupported" type
Date: Sat,  2 Mar 2019 16:08:02 +0300	[thread overview]
Message-ID: <fe552bb49cd825514b77c55ee10f16284581eb56.1551530224.git.imeevma@gmail.com> (raw)
In-Reply-To: <cover.1551530224.git.imeevma@gmail.com>

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;
 	]], {
 		-- <analyzeD-1.12>
-		1, "VIEW isn't allowed to be analyzed"
+		1, "ANALYZE statement argument V is not a base table"
 		-- <analyzeD-1.12>
 	})
 
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;
     ]], {
         -- <join-2.3>
-        1, "RIGHT and FULL OUTER JOINs are not currently supported"
+        1, "Tarantool does not support RIGHT and FULL OUTER JOINs"
         -- </join-2.3>
     })
 
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"
   -- </16.1>
 })
 
-- 
2.7.4

  parent reply	other threads:[~2019-03-02 13:08 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-02 13:07 [tarantool-patches] [PATCH v3 0/9] sql: use diag_set() for errors in SQL imeevma
2019-03-02 13:07 ` [tarantool-patches] [PATCH v3 1/9] sql: rework syntax errors imeevma
2019-03-04 17:47   ` [tarantool-patches] " n.pettik
2019-03-05  8:31   ` Konstantin Osipov
2019-03-02 13:07 ` [tarantool-patches] [PATCH v3 2/9] sql: save SQL parser errors in diag_set() imeevma
2019-03-05  8:40   ` [tarantool-patches] " Konstantin Osipov
2019-03-05  9:06   ` n.pettik
2019-03-02 13:07 ` [tarantool-patches] [PATCH v3 3/9] sql: remove field nErr of struct Parse imeevma
2019-03-05  8:41   ` [tarantool-patches] " Konstantin Osipov
2019-03-05  9:06   ` n.pettik
2019-03-02 13:07 ` [tarantool-patches] [PATCH v3 4/9] sql: remove field rc " imeevma
2019-03-05  8:42   ` [tarantool-patches] " Konstantin Osipov
2019-03-05  9:06   ` n.pettik
2019-03-02 13:07 ` [tarantool-patches] [PATCH v3 5/9] sql: remove field zErrMsg " imeevma
2019-03-05  8:43   ` [tarantool-patches] " Konstantin Osipov
2019-03-05  9:06   ` n.pettik
2019-03-02 13:07 ` [tarantool-patches] [PATCH v3 6/9] sql: rework six syntax errors imeevma
2019-03-05  8:45   ` [tarantool-patches] " Konstantin Osipov
2019-03-05  9:07   ` n.pettik
2019-03-02 13:08 ` [tarantool-patches] [PATCH v3 7/9] sql: rework four semantic errors imeevma
2019-03-05  8:46   ` [tarantool-patches] " Konstantin Osipov
2019-03-05  9:16   ` n.pettik
2019-03-02 13:08 ` imeevma [this message]
2019-03-05  8:47   ` [tarantool-patches] Re: [PATCH v3 8/9] sql: rework three errors of "unsupported" type Konstantin Osipov
2019-03-05  9:34   ` n.pettik
2019-03-05  9:43     ` Konstantin Osipov
2019-03-02 13:08 ` [tarantool-patches] [PATCH v3 9/9] sql: remove sqlErrorMsg() imeevma
2019-03-05  8:48   ` [tarantool-patches] " Konstantin Osipov
2019-03-05 12:16   ` n.pettik
2019-03-05 15:44     ` Konstantin Osipov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fe552bb49cd825514b77c55ee10f16284581eb56.1551530224.git.imeevma@gmail.com \
    --to=imeevma@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH v3 8/9] sql: rework three errors of "unsupported" type' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox