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 71EF0240A2 for ; Wed, 13 Mar 2019 13:03:09 -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 J8u2YCIp8Ktf for ; Wed, 13 Mar 2019 13:03:09 -0400 (EDT) Received: from smtp49.i.mail.ru (smtp49.i.mail.ru [94.100.177.109]) (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 977F22971E for ; Wed, 13 Mar 2019 13:03:08 -0400 (EDT) From: imeevma@tarantool.org Subject: [tarantool-patches] [PATCH v4 1/8] sql: rework syntax errors Date: Wed, 13 Mar 2019 20:03:06 +0300 Message-Id: MIME-Version: 1.0 In-Reply-To: References: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit 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 This patch reworks SQL syntax errors. After this patch, these error will be set as Tarantool errors. Part of #3965 --- src/box/errcode.h | 7 +++++ src/box/sql/build.c | 6 ++--- src/box/sql/parse.y | 41 ++++++++++++++++++------------ src/box/sql/select.c | 11 ++++---- src/box/sql/tokenize.c | 7 ++--- test/box/misc.result | 6 +++++ test/sql-tap/alter2.test.lua | 4 +-- test/sql-tap/blob.test.lua | 20 +++++++-------- test/sql-tap/check.test.lua | 10 ++++---- test/sql-tap/colname.test.lua | 2 +- test/sql-tap/count.test.lua | 2 +- test/sql-tap/default.test.lua | 4 +-- test/sql-tap/e_select1.test.lua | 18 ++++++------- test/sql-tap/gh2168-temp-tables.test.lua | 4 +-- test/sql-tap/identifier_case.test.lua | 2 +- test/sql-tap/index-info.test.lua | 2 +- test/sql-tap/index1.test.lua | 2 +- test/sql-tap/index7.test.lua | 2 +- test/sql-tap/join.test.lua | 2 +- test/sql-tap/keyword1.test.lua | 2 +- test/sql-tap/misc1.test.lua | 8 +++--- test/sql-tap/misc5.test.lua | 6 ++--- test/sql-tap/null.test.lua | 8 +++--- test/sql-tap/pragma.test.lua | 4 +-- test/sql-tap/select1.test.lua | 20 +++++++-------- test/sql-tap/select3.test.lua | 4 +-- test/sql-tap/start-transaction.test.lua | 14 +++++----- test/sql-tap/table.test.lua | 10 ++++---- test/sql-tap/tkt3935.test.lua | 14 +++++----- test/sql-tap/tokenize.test.lua | 26 +++++++++---------- test/sql-tap/trigger1.test.lua | 14 +++++----- test/sql-tap/view.test.lua | 4 +-- test/sql-tap/with1.test.lua | 6 ++--- test/sql-tap/with2.test.lua | 18 ++++++------- test/sql/checks.result | 2 +- test/sql/collation.result | 12 ++++----- test/sql/foreign-keys.result | 10 +++++--- test/sql/gh-3888-values-blob-assert.result | 8 +++--- test/sql/iproto.result | 10 ++++---- test/sql/misc.result | 14 +++++----- test/sql/on-conflict.result | 16 ++++++------ test/sql/types.result | 13 ++++++---- 42 files changed, 213 insertions(+), 182 deletions(-) diff --git a/src/box/errcode.h b/src/box/errcode.h index a1fcf01..f2f47c0 100644 --- a/src/box/errcode.h +++ b/src/box/errcode.h @@ -231,6 +231,13 @@ struct errcode_record { /*176 */_(ER_SQL_CANT_RESOLVE_FIELD, "Can’t resolve field '%s'") \ /*177 */_(ER_INDEX_EXISTS_IN_SPACE, "Index '%s' already exists in space '%s'") \ /*178 */_(ER_INCONSISTENT_TYPES, "Inconsistent types: expected %s got %s") \ + /*179 */_(ER_SQL_SYNTAX, "Syntax error in %s: %s") \ + /*180 */_(ER_SQL_STACK_OVERFLOW, "Failed to parse SQL statement: parser stack limit reached") \ + /*181 */_(ER_SQL_SELECT_WILDCARD, "Failed to expand '*' in SELECT statement without FROM clause") \ + /*182 */_(ER_SQL_STATEMENT_EMPTY, "Failed to execute an empty SQL statement") \ + /*183 */_(ER_SQL_KEYWORD_IS_RESERVED, "Keyword '%.*s' is reserved. Please use double quotes if '%.*s' is an identifier.") \ + /*184 */_(ER_SQL_UNRECOGNIZED_SYNTAX, "Syntax error near '%.*s'") \ + /*185 */_(ER_SQL_UNKNOWN_TOKEN, "Syntax error: unrecognized token: '%.*s'") \ /* * !IMPORTANT! Please follow instructions at start of the file diff --git a/src/box/sql/build.c b/src/box/sql/build.c index e9851d9..f112c9f 100644 --- a/src/box/sql/build.c +++ b/src/box/sql/build.c @@ -2823,9 +2823,9 @@ sqlSrcListAppendFromTerm(Parse * pParse, /* Parsing context */ struct SrcList_item *pItem; sql *db = pParse->db; if (!p && (pOn || pUsing)) { - sqlErrorMsg(pParse, "a JOIN clause is required before %s", - (pOn ? "ON" : "USING") - ); + diag_set(ClientError, ER_SQL_SYNTAX, "FROM clause", + "a JOIN clause is required before ON and USING"); + sql_parser_error(pParse); goto append_from_error; } p = sqlSrcListAppend(db, p, pTable); diff --git a/src/box/sql/parse.y b/src/box/sql/parse.y index 996f55d..66fb44b 100644 --- a/src/box/sql/parse.y +++ b/src/box/sql/parse.y @@ -33,13 +33,16 @@ UNUSED_PARAMETER(yymajor); /* Silence some compiler warnings */ assert( TOKEN.z[0] ); /* The tokenizer always gives us a token */ if (yypParser->is_fallback_failed && TOKEN.isReserved) { - sqlErrorMsg(pParse, "keyword \"%T\" is reserved", &TOKEN); + diag_set(ClientError, ER_SQL_KEYWORD_IS_RESERVED, TOKEN.n, TOKEN.z, + TOKEN.n, TOKEN.z); } else { - sqlErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN); + diag_set(ClientError, ER_SQL_UNRECOGNIZED_SYNTAX, TOKEN.n, TOKEN.z); } + sql_parser_error(pParse); } %stack_overflow { - sqlErrorMsg(pParse, "parser stack overflow"); + diag_set(ClientError, ER_SQL_STACK_OVERFLOW); + sql_parser_error(pParse); } // The name of the generated procedure that implements the parser @@ -114,7 +117,8 @@ ecmd ::= explain cmdx SEMI. { sql_finish_coding(pParse); } ecmd ::= SEMI. { - sqlErrorMsg(pParse, "syntax error: empty request"); + diag_set(ClientError, ER_SQL_STATEMENT_EMPTY); + sql_parser_error(pParse); } explain ::= . explain ::= EXPLAIN. { pParse->explain = 1; } @@ -227,7 +231,8 @@ columnname(A) ::= nm(A) typedef(Y). {sqlAddColumn(pParse,&A,&Y);} %type nm {Token} nm(A) ::= id(A). { if(A.isReserved) { - sqlErrorMsg(pParse, "keyword \"%T\" is reserved", &A); + diag_set(ClientError, ER_SQL_KEYWORD_IS_RESERVED, A.n, A.z, A.n, A.z); + sql_parser_error(pParse); } } @@ -897,14 +902,17 @@ expr(A) ::= VARIABLE(X). { } else if (!(X.z[0]=='#' && sqlIsdigit(X.z[1]))) { u32 n = X.n; spanExpr(&A, pParse, TK_VARIABLE, X); - if (A.pExpr->u.zToken[0] == '?' && n > 1) - sqlErrorMsg(pParse, "near \"%T\": syntax error", &t); - else - sqlExprAssignVarNumber(pParse, A.pExpr, n); + if (A.pExpr->u.zToken[0] == '?' && n > 1) { + diag_set(ClientError, ER_SQL_UNRECOGNIZED_SYNTAX, t.n, t.z); + sql_parser_error(pParse); + } else { + sqlExprAssignVarNumber(pParse, A.pExpr, n); + } }else{ assert( t.n>=2 ); spanSet(&A, &t, &t); - sqlErrorMsg(pParse, "near \"%T\": syntax error", &t); + diag_set(ClientError, ER_SQL_UNRECOGNIZED_SYNTAX, t.n, t.z); + sql_parser_error(pParse); A.pExpr = NULL; } } @@ -1378,14 +1386,15 @@ trnm(A) ::= nm DOT nm(X). { // tridxby ::= . tridxby ::= INDEXED BY nm. { - sqlErrorMsg(pParse, - "the INDEXED BY clause is not allowed on UPDATE or DELETE statements " - "within triggers"); + diag_set(ClientError, ER_SQL_SYNTAX, "trigger body", "the INDEXED BY clause "\ + "is not allowed on UPDATE or DELETE statements within triggers"); + sql_parser_error(pParse); } tridxby ::= NOT INDEXED. { - sqlErrorMsg(pParse, - "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements " - "within triggers"); + diag_set(ClientError, ER_SQL_SYNTAX, "trigger body", "the NOT INDEXED "\ + "clause is not allowed on UPDATE or DELETE statements within "\ + "triggers"); + sql_parser_error(pParse); } diff --git a/src/box/sql/select.c b/src/box/sql/select.c index 782da1f..ef24760 100644 --- a/src/box/sql/select.c +++ b/src/box/sql/select.c @@ -2092,8 +2092,9 @@ computeLimitRegisters(Parse * pParse, Select * p, int iBreak) if((p->pLimit->flags & EP_Collate) != 0 || (p->pOffset != NULL && (p->pOffset->flags & EP_Collate) != 0)) { - sqlErrorMsg(pParse, "near \"COLLATE\": "\ - "syntax error"); + diag_set(ClientError, ER_SQL_UNRECOGNIZED_SYNTAX, + sizeof("COLLATE"), "COLLATE"); + sql_parser_error(pParse); return; } p->iLimit = iLimit = ++pParse->nMem; @@ -5049,11 +5050,11 @@ selectExpander(Walker * pWalker, Select * p) diag_set(ClientError, ER_NO_SUCH_SPACE, zTName); - sql_parser_error(pParse); } else { - sqlErrorMsg(pParse, - "no tables specified"); + diag_set(ClientError, + ER_SQL_SELECT_WILDCARD); } + sql_parser_error(pParse); } } } diff --git a/src/box/sql/tokenize.c b/src/box/sql/tokenize.c index abf837d..58685c4 100644 --- a/src/box/sql/tokenize.c +++ b/src/box/sql/tokenize.c @@ -506,9 +506,10 @@ sqlRunParser(Parse * pParse, const char *zSql, char **pzErrMsg) break; } if (tokenType == TK_ILLEGAL) { - sqlErrorMsg(pParse, - "unrecognized token: \"%T\"", - &pParse->sLastToken); + diag_set(ClientError, ER_SQL_UNKNOWN_TOKEN, + pParse->sLastToken.n, + pParse->sLastToken.z); + sql_parser_error(pParse); break; } } else { diff --git a/test/box/misc.result b/test/box/misc.result index d9f5dd5..27579c6 100644 --- a/test/box/misc.result +++ b/test/box/misc.result @@ -508,6 +508,12 @@ t; 176: box.error.SQL_CANT_RESOLVE_FIELD 177: box.error.INDEX_EXISTS_IN_SPACE 178: box.error.INCONSISTENT_TYPES + 179: box.error.SQL_SYNTAX + 180: box.error.SQL_STACK_OVERFLOW + 181: box.error.SQL_SELECT_WILDCARD + 182: box.error.SQL_STATEMENT_EMPTY + 184: box.error.SQL_UNRECOGNIZED_SYNTAX + 185: box.error.SQL_UNKNOWN_TOKEN ... test_run:cmd("setopt delimiter ''"); --- diff --git a/test/sql-tap/alter2.test.lua b/test/sql-tap/alter2.test.lua index e219a36..beb6f5d 100755 --- a/test/sql-tap/alter2.test.lua +++ b/test/sql-tap/alter2.test.lua @@ -223,7 +223,7 @@ test:do_catchsql_test( ALTER TABLE child ADD CONSTRAINT fk FOREIGN KEY REFERENCES child(id); ]], { -- - 1, "near \"REFERENCES\": syntax error" + 1, "Syntax error near 'REFERENCES'" -- }) @@ -233,7 +233,7 @@ test:do_catchsql_test( ALTER TABLE child ADD CONSTRAINT fk () FOREIGN KEY REFERENCES child(id); ]], { -- - 1, "near \"(\": syntax error" + 1, "Syntax error near '('" -- }) diff --git a/test/sql-tap/blob.test.lua b/test/sql-tap/blob.test.lua index 376d5b1..2b5c7a9 100755 --- a/test/sql-tap/blob.test.lua +++ b/test/sql-tap/blob.test.lua @@ -72,7 +72,7 @@ test:do_catchsql_test( SELECT X'01020k304', 100 ]], { -- - 1, [[unrecognized token: "X'01020k304'"]] + 1, [[Syntax error: unrecognized token: 'X'01020k304'']] -- }) @@ -81,7 +81,7 @@ test:do_catchsql_test( [[ SELECT X'01020, 100]], { -- - 1, [[unrecognized token: "X'01020, 100"]] + 1, [[Syntax error: unrecognized token: 'X'01020, 100']] -- }) @@ -91,7 +91,7 @@ test:do_catchsql_test( SELECT X'01020 100' ]], { -- - 1, [[unrecognized token: "X'01020 100'"]] + 1, [[Syntax error: unrecognized token: 'X'01020 100'']] -- }) @@ -101,7 +101,7 @@ test:do_catchsql_test( SELECT X'01001' ]], { -- - 1, [[unrecognized token: "X'01001'"]] + 1, [[Syntax error: unrecognized token: 'X'01001'']] -- }) @@ -111,7 +111,7 @@ test:do_catchsql_test( SELECT x'012/45' ]], { -- - 1, [[unrecognized token: "x'012/45'"]] + 1, [[Syntax error: unrecognized token: 'x'012/45'']] -- }) @@ -121,7 +121,7 @@ test:do_catchsql_test( SELECT x'012:45' ]], { -- - 1, [[unrecognized token: "x'012:45'"]] + 1, [[Syntax error: unrecognized token: 'x'012:45'']] -- }) @@ -131,7 +131,7 @@ test:do_catchsql_test( SELECT x'012@45' ]], { -- - 1, [[unrecognized token: "x'012@45'"]] + 1, [[Syntax error: unrecognized token: 'x'012@45'']] -- }) @@ -141,7 +141,7 @@ test:do_catchsql_test( SELECT x'012G45' ]], { -- - 1, [[unrecognized token: "x'012G45'"]] + 1, [[Syntax error: unrecognized token: 'x'012G45'']] -- }) @@ -151,7 +151,7 @@ test:do_catchsql_test( SELECT x'012`45' ]], { -- - 1, [[unrecognized token: "x'012`45'"]] + 1, [[Syntax error: unrecognized token: 'x'012`45'']] -- }) @@ -161,7 +161,7 @@ test:do_catchsql_test( SELECT x'012g45' ]], { -- - 1, [[unrecognized token: "x'012g45'"]] + 1, [[Syntax error: unrecognized token: 'x'012g45'']] -- }) diff --git a/test/sql-tap/check.test.lua b/test/sql-tap/check.test.lua index 2bb1b2e..b6b7fc7 100755 --- a/test/sql-tap/check.test.lua +++ b/test/sql-tap/check.test.lua @@ -281,7 +281,7 @@ test:do_catchsql_test( ); ]], { -- - 1,"near \",\": syntax error" + 1,"Syntax error near ','" -- }) @@ -295,7 +295,7 @@ test:do_catchsql_test( ); ]], { -- - 1,"near \",\": syntax error" + 1,"Syntax error near ','" -- }) @@ -781,7 +781,7 @@ test:do_catchsql_test( ON CONFLICT REPLACE) ]], { -- <9.1> - 1, "keyword \"ON\" is reserved" + 1, "Keyword 'ON' is reserved. Please use double quotes if 'ON' is an identifier." -- }) @@ -792,7 +792,7 @@ test:do_catchsql_test( ON CONFLICT ABORT) ]], { -- <9.2> - 1, "keyword \"ON\" is reserved" + 1, "Keyword 'ON' is reserved. Please use double quotes if 'ON' is an identifier." -- }) @@ -803,7 +803,7 @@ test:do_catchsql_test( ON CONFLICT ROLLBACK) ]], { -- <9.3> - 1, "keyword \"ON\" is reserved" + 1, "Keyword 'ON' is reserved. Please use double quotes if 'ON' is an identifier." -- }) diff --git a/test/sql-tap/colname.test.lua b/test/sql-tap/colname.test.lua index b7dd2b7..29fdf13 100755 --- a/test/sql-tap/colname.test.lua +++ b/test/sql-tap/colname.test.lua @@ -576,7 +576,7 @@ for i, val in ipairs(data) do end local data2 = { - {[['a']],{1, "/syntax error/"}}, -- because ' is delimiter for strings + {[['a']],{1, "/Syntax error/"}}, -- because ' is delimiter for strings {[[`a`]],{1, "/unrecognized token/"}}, -- because ` is undefined symbol {"[a]",{1, "/unrecognized token/"}} -- because [ is undefined symbol } diff --git a/test/sql-tap/count.test.lua b/test/sql-tap/count.test.lua index fbd60da..cf5bfcc 100755 --- a/test/sql-tap/count.test.lua +++ b/test/sql-tap/count.test.lua @@ -128,7 +128,7 @@ test:do_catchsql_test( SELECT count(DISTINCT *) FROM t2 ]], { -- - 1, [[near "*": syntax error]] + 1, [[Syntax error near '*']] -- }) diff --git a/test/sql-tap/default.test.lua b/test/sql-tap/default.test.lua index 267ce88..67151b0 100755 --- a/test/sql-tap/default.test.lua +++ b/test/sql-tap/default.test.lua @@ -224,7 +224,7 @@ test:do_catchsql_test( CREATE TABLE t6(id INTEGER PRIMARY KEY, b TEXT DEFAULT id); ]], { -- - 1, "near \"id\": syntax error" + 1, "Syntax error near 'id'" -- }) @@ -234,7 +234,7 @@ test:do_catchsql_test( CREATE TABLE t6(id INTEGER PRIMARY KEY, b TEXT DEFAULT "id"); ]], { -- - 1, "near \"\"id\"\": syntax error" + 1, "Syntax error near '\"id\"'" -- }) diff --git a/test/sql-tap/e_select1.test.lua b/test/sql-tap/e_select1.test.lua index 75fe81e..e190ad7 100755 --- a/test/sql-tap/e_select1.test.lua +++ b/test/sql-tap/e_select1.test.lua @@ -105,7 +105,7 @@ test:do_catchsql_test( SELECT count(*) FROM t1, t2 USING (a) ON (t1.a=t2.a) ]], { -- - 1, [[keyword "ON" is reserved]] + 1, [[Keyword 'ON' is reserved. Please use double quotes if 'ON' is an identifier.]] -- }) @@ -807,14 +807,14 @@ test:do_select_tests( -- FROM clause. -- data = { - {"1.1", "SELECT a, b, c FROM z1 WHERE *", 'near \"*\": syntax error'}, - {"1.2", "SELECT a, b, c FROM z1 GROUP BY *", 'near \"*\": syntax error'}, - {"1.3", "SELECT 1 + * FROM z1", 'near \"*\": syntax error'}, - {"1.4", "SELECT * + 1 FROM z1", 'near \"+\": syntax error'}, - {"2.1", "SELECT *", 'no tables specified'}, - {"2.2", "SELECT * WHERE 1", 'no tables specified'}, - {"2.3", "SELECT * WHERE 0", 'no tables specified'}, - {"2.4", "SELECT count(*), *", 'no tables specified' } + {"1.1", "SELECT a, b, c FROM z1 WHERE *", "Syntax error near '*'"}, + {"1.2", "SELECT a, b, c FROM z1 GROUP BY *", "Syntax error near '*'"}, + {"1.3", "SELECT 1 + * FROM z1", "Syntax error near '*'"}, + {"1.4", "SELECT * + 1 FROM z1", "Syntax error near '+'"}, + {"2.1", "SELECT *", "Failed to expand '*' in SELECT statement without FROM clause"}, + {"2.2", "SELECT * WHERE 1", "Failed to expand '*' in SELECT statement without FROM clause"}, + {"2.3", "SELECT * WHERE 0", "Failed to expand '*' in SELECT statement without FROM clause"}, + {"2.4", "SELECT count(*), *", "Failed to expand '*' in SELECT statement without FROM clause"} } for _, val in ipairs(data) do diff --git a/test/sql-tap/gh2168-temp-tables.test.lua b/test/sql-tap/gh2168-temp-tables.test.lua index 536e187..3b29c9e 100755 --- a/test/sql-tap/gh2168-temp-tables.test.lua +++ b/test/sql-tap/gh2168-temp-tables.test.lua @@ -8,7 +8,7 @@ test:do_catchsql_test( CREATE TEMP TABLE tmp1 (id INTEGER PRIMARY KEY); ]], { -- - 1, "near \"TEMP\": syntax error" + 1, "Syntax error near 'TEMP'" -- }); @@ -23,7 +23,7 @@ test:do_catchsql_test( END; ]], { -- - 1, "near \"TEMP\": syntax error" + 1, "Syntax error near 'TEMP'" -- }); diff --git a/test/sql-tap/identifier_case.test.lua b/test/sql-tap/identifier_case.test.lua index 923d5e6..74c7ce2 100755 --- a/test/sql-tap/identifier_case.test.lua +++ b/test/sql-tap/identifier_case.test.lua @@ -238,7 +238,7 @@ test:do_catchsql_test( data = { { 1, [[ 'a' < 'b' collate binary ]], {1, "Collation 'BINARY' does not exist"}}, { 2, [[ 'a' < 'b' collate "binary" ]], {0, {1}}}, - { 3, [[ 'a' < 'b' collate 'binary' ]], {1, [[near "'binary'": syntax error]]}}, + { 3, [[ 'a' < 'b' collate 'binary' ]], {1, [[Syntax error near ''binary'']]}}, { 4, [[ 'a' < 'b' collate "unicode" ]], {0, {1}}}, { 5, [[ 5 < 'b' collate "unicode" ]], {0, {1}}}, { 6, [[ 5 < 'b' collate unicode ]], {1,"Collation 'UNICODE' does not exist"}}, diff --git a/test/sql-tap/index-info.test.lua b/test/sql-tap/index-info.test.lua index d052e8c..a5ed9a9 100755 --- a/test/sql-tap/index-info.test.lua +++ b/test/sql-tap/index-info.test.lua @@ -26,7 +26,7 @@ test:do_catchsql_test( "index-info-1.2", "PRAGMA index_info = t1.a;", { - 1, "near \".\": syntax error", + 1, "Syntax error near '.'", }) -- Case: single column index with an integer column. diff --git a/test/sql-tap/index1.test.lua b/test/sql-tap/index1.test.lua index fa97018..b23e9b3 100755 --- a/test/sql-tap/index1.test.lua +++ b/test/sql-tap/index1.test.lua @@ -994,7 +994,7 @@ test:do_catchsql_test( CREATE INDEX temp.i21 ON t6(c); ]], { -- - 1, "near \".\": syntax error" + 1, "Syntax error near '.'" -- }) diff --git a/test/sql-tap/index7.test.lua b/test/sql-tap/index7.test.lua index 0a7fe60..7dd9efa 100755 --- a/test/sql-tap/index7.test.lua +++ b/test/sql-tap/index7.test.lua @@ -292,7 +292,7 @@ test:do_catchsql_test( CREATE TABLE t1 (a INTEGER PRIMARY KEY, b INTEGER); CREATE UNIQUE INDEX i ON t1 (a) WHERE a = 3; ]], { - 1, "keyword \"WHERE\" is reserved" + 1, "Keyword 'WHERE' is reserved. Please use double quotes if 'WHERE' is an identifier." }) -- Currently, when a user tries to create index (or primary key, diff --git a/test/sql-tap/join.test.lua b/test/sql-tap/join.test.lua index bda4091..df272a9 100755 --- a/test/sql-tap/join.test.lua +++ b/test/sql-tap/join.test.lua @@ -570,7 +570,7 @@ test:do_catchsql_test( SELECT * FROM t1 USING(a) ]], { -- - 1, "a JOIN clause is required before USING" + 1, "Syntax error in FROM clause: a JOIN clause is required before ON and USING" -- }) diff --git a/test/sql-tap/keyword1.test.lua b/test/sql-tap/keyword1.test.lua index 44fa1cf..9c524d6 100755 --- a/test/sql-tap/keyword1.test.lua +++ b/test/sql-tap/keyword1.test.lua @@ -238,7 +238,7 @@ for _, kw in ipairs(bannedkws) do test:do_catchsql_test( "bannedkw1-"..kw..".1", query, { - 1, 'keyword "'..kw..'" is reserved' + 1, "Keyword '"..kw.."' is reserved. Please use double quotes if '"..kw.."' is an identifier." }) end diff --git a/test/sql-tap/misc1.test.lua b/test/sql-tap/misc1.test.lua index 4358b58..1b288da 100755 --- a/test/sql-tap/misc1.test.lua +++ b/test/sql-tap/misc1.test.lua @@ -271,7 +271,7 @@ test:do_catchsql_test( UPDATE t3 SET a=0 WHEREwww b=2; ]], { -- - 1, [[near "WHEREwww": syntax error]] + 1, [[Syntax error near 'WHEREwww']] -- }) @@ -413,7 +413,7 @@ test:do_catchsql_test( SELECT *; ]], { -- - 1, "no tables specified" + 1, "Failed to expand '*' in SELECT statement without FROM clause" -- }) @@ -1037,7 +1037,7 @@ test:do_catchsql_test( select''like''like''like#0; ]], { -- - 1, [[near "#0": syntax error]] + 1, [[Syntax error near '#0']] -- }) @@ -1047,7 +1047,7 @@ test:do_catchsql_test( VALUES(0,0x0MATCH#0; ]], { -- - 1, [[near ";": syntax error]] + 1, [[Syntax error near ';']] -- }) diff --git a/test/sql-tap/misc5.test.lua b/test/sql-tap/misc5.test.lua index 0852741..5f98f21 100755 --- a/test/sql-tap/misc5.test.lua +++ b/test/sql-tap/misc5.test.lua @@ -299,7 +299,7 @@ test:do_test( return test:catchsql(sql) end, { -- - 1, "parser stack overflow" + 1, "Failed to parse SQL statement: parser stack limit reached" -- }) @@ -347,7 +347,7 @@ test:do_catchsql_test( SELECT 123abc ]], { -- - 1, [[unrecognized token: "123abc"]] + 1, [[Syntax error: unrecognized token: '123abc']] -- }) @@ -357,7 +357,7 @@ test:do_catchsql_test( SELECT 1*123.4e5ghi; ]], { -- - 1, [[unrecognized token: "123.4e5ghi"]] + 1, [[Syntax error: unrecognized token: '123.4e5ghi']] -- }) diff --git a/test/sql-tap/null.test.lua b/test/sql-tap/null.test.lua index 66135d3..50a2cfb 100755 --- a/test/sql-tap/null.test.lua +++ b/test/sql-tap/null.test.lua @@ -517,7 +517,7 @@ test:do_catchsql_test( ]], { -- - 1, "near \"1\": syntax error" + 1, "Syntax error near '1'" -- }) @@ -528,7 +528,7 @@ test:do_catchsql_test( ]], { -- - 1, "near \"1\": syntax error" + 1, "Syntax error near '1'" -- }) @@ -539,7 +539,7 @@ test:do_catchsql_test( ]], { -- - 1, "near \"1\": syntax error" + 1, "Syntax error near '1'" -- }) @@ -550,7 +550,7 @@ test:do_catchsql_test( ]], { -- - 1, "near \"1\": syntax error" + 1, "Syntax error near '1'" -- }) diff --git a/test/sql-tap/pragma.test.lua b/test/sql-tap/pragma.test.lua index 975a0e9..14d622f 100755 --- a/test/sql-tap/pragma.test.lua +++ b/test/sql-tap/pragma.test.lua @@ -43,7 +43,7 @@ test:do_catchsql_test( [[ pragma sql_default_engine 'memtx'; ]], { - 1, 'near \"\'memtx\'\": syntax error' + 1, "Syntax error near ''memtx''" }) test:do_catchsql_test( @@ -51,7 +51,7 @@ test:do_catchsql_test( [[ pragma sql_default_engine 1; ]], { - 1, 'near \"1\": syntax error' + 1, "Syntax error near '1'" }) -- diff --git a/test/sql-tap/select1.test.lua b/test/sql-tap/select1.test.lua index 6c35b6f..d73429a 100755 --- a/test/sql-tap/select1.test.lua +++ b/test/sql-tap/select1.test.lua @@ -1406,7 +1406,7 @@ test:do_catchsql_test( SELECT f1 FROM test1 WHERE f2=; ]], { -- - 1, [[near ";": syntax error]] + 1, [[Syntax error near ';']] -- }) @@ -1416,7 +1416,7 @@ test:do_catchsql_test( SELECT f1 FROM test1 UNION SELECT WHERE; ]], { -- - 1, [[keyword "WHERE" is reserved]] + 1, [[Keyword 'WHERE' is reserved. Please use double quotes if 'WHERE' is an identifier.]] -- }) @@ -1428,7 +1428,7 @@ test:do_catchsql_test( [[ SELECT f1 FROM test1 as "hi", test2 as]], { -- - 1, [[keyword "as" is reserved]] + 1, [[Keyword 'as' is reserved. Please use double quotes if 'as' is an identifier.]] -- }) @@ -1438,7 +1438,7 @@ test:do_catchsql_test( SELECT f1 FROM test1 ORDER BY; ]], { -- - 1, [[near ";": syntax error]] + 1, [[Syntax error near ';']] -- }) @@ -1448,7 +1448,7 @@ test:do_catchsql_test( SELECT f1 FROM test1 ORDER BY f1 desc, f2 where; ]], { -- - 1, [[keyword "where" is reserved]] + 1, [[Keyword 'where' is reserved. Please use double quotes if 'where' is an identifier.]] -- }) @@ -1458,7 +1458,7 @@ test:do_catchsql_test( SELECT count(f1,f2 FROM test1; ]], { -- - 1, [[keyword "FROM" is reserved]] + 1, [[Keyword 'FROM' is reserved. Please use double quotes if 'FROM' is an identifier.]] -- }) @@ -1468,7 +1468,7 @@ test:do_catchsql_test( SELECT count(f1,f2+) FROM test1; ]], { -- - 1, [[near ")": syntax error]] + 1, [[Syntax error near ')']] -- }) @@ -1478,7 +1478,7 @@ test:do_catchsql_test( SELECT f1 FROM test1 ORDER BY f2, f1+; ]], { -- - 1, [[near ";": syntax error]] + 1, [[Syntax error near ';']] -- }) @@ -1488,7 +1488,7 @@ test:do_catchsql_test( SELECT f1 FROM test1 LIMIT 5+3 OFFSET 11 ORDER BY f2; ]], { -- - 1, [[keyword "ORDER" is reserved]] + 1, [[Keyword 'ORDER' is reserved. Please use double quotes if 'ORDER' is an identifier.]] -- }) @@ -2075,7 +2075,7 @@ test:do_catchsql_test( SELECT 1 FROM (SELECT *) ]], { -- - 1, "no tables specified" + 1, "Failed to expand '*' in SELECT statement without FROM clause" -- }) diff --git a/test/sql-tap/select3.test.lua b/test/sql-tap/select3.test.lua index e7e306e..9fb825f 100755 --- a/test/sql-tap/select3.test.lua +++ b/test/sql-tap/select3.test.lua @@ -182,7 +182,7 @@ test:do_catchsql_test("select3-2.13", [[ SELECT log, count(*) FROM t1 GROUP BY ORDER BY log; ]], { -- - 1, [[keyword "ORDER" is reserved]] + 1, [[Keyword 'ORDER' is reserved. Please use double quotes if 'ORDER' is an identifier.]] -- }) @@ -190,7 +190,7 @@ test:do_catchsql_test("select3-2.14", [[ SELECT log, count(*) FROM t1 GROUP BY; ]], { -- - 1, [[near ";": syntax error]] + 1, [[Syntax error near ';']] -- }) diff --git a/test/sql-tap/start-transaction.test.lua b/test/sql-tap/start-transaction.test.lua index 82356ae..c5703d4 100755 --- a/test/sql-tap/start-transaction.test.lua +++ b/test/sql-tap/start-transaction.test.lua @@ -21,7 +21,7 @@ test:do_catchsql_test( COMMIT; ]], { -- - 1, "near \"BEGIN\": syntax error" + 1, "Syntax error near 'BEGIN'" -- }) @@ -46,7 +46,7 @@ test:do_catchsql_test( COMMIT; ]], { -- - 1, "near \"BEGIN\": syntax error" + 1, "Syntax error near 'BEGIN'" -- }) @@ -94,7 +94,7 @@ test:do_catchsql_test( COMMIT TRANSACTION; ]], { -- - 1, "keyword \"TRANSACTION\" is reserved" + 1, "Keyword 'TRANSACTION' is reserved. Please use double quotes if 'TRANSACTION' is an identifier." -- }) @@ -119,7 +119,7 @@ test:do_catchsql_test( END; ]], { -- - 1, "keyword \"END\" is reserved" + 1, "Keyword 'END' is reserved. Please use double quotes if 'END' is an identifier." -- }) @@ -144,7 +144,7 @@ test:do_catchsql_test( END TRANSACTION; ]], { -- - 1, "keyword \"END\" is reserved" + 1, "Keyword 'END' is reserved. Please use double quotes if 'END' is an identifier." -- }) @@ -193,7 +193,7 @@ test:do_catchsql_test( COMMIT; ]], { -- - 1, "keyword \"TRANSACTION\" is reserved" + 1, "Keyword 'TRANSACTION' is reserved. Please use double quotes if 'TRANSACTION' is an identifier." -- }) @@ -246,7 +246,7 @@ test:do_catchsql_test( COMMIT; ]], { -- - 1, "keyword \"TRANSACTION\" is reserved" + 1, "Keyword 'TRANSACTION' is reserved. Please use double quotes if 'TRANSACTION' is an identifier." -- }) diff --git a/test/sql-tap/table.test.lua b/test/sql-tap/table.test.lua index aa3eea8..c89d890 100755 --- a/test/sql-tap/table.test.lua +++ b/test/sql-tap/table.test.lua @@ -620,7 +620,7 @@ test:do_catchsql_test( CREATE TEMP TABLE t1(a INTEGER PRIMARY KEY, b VARCHAR(10)); ]], { -- - 1, "near \"TEMP\": syntax error" + 1, "Syntax error near 'TEMP'" -- }) @@ -630,7 +630,7 @@ test:do_catchsql_test( CREATE TEMPORARY TABLE t1(a INTEGER PRIMARY KEY, b VARCHAR(10)); ]], { -- - 1, "near \"TEMPORARY\": syntax error" + 1, "Syntax error near 'TEMPORARY'" -- }) @@ -1257,7 +1257,7 @@ test:do_catchsql_test( ); ]], { -- - 1,"keyword \"CONSTRAINT\" is reserved" + 1,"Keyword 'CONSTRAINT' is reserved. Please use double quotes if 'CONSTRAINT' is an identifier." -- }) @@ -1322,7 +1322,7 @@ test:do_catchsql_test( ); ]], { -- - 1,"keyword \"CONSTRAINT\" is reserved" + 1,"Keyword 'CONSTRAINT' is reserved. Please use double quotes if 'CONSTRAINT' is an identifier." -- }) @@ -1336,7 +1336,7 @@ test:do_catchsql_test( ); ]], { -- - 1,"keyword \"CONSTRAINT\" is reserved" + 1,"Keyword 'CONSTRAINT' is reserved. Please use double quotes if 'CONSTRAINT' is an identifier." -- }) diff --git a/test/sql-tap/tkt3935.test.lua b/test/sql-tap/tkt3935.test.lua index e13391c..cc8fea7 100755 --- a/test/sql-tap/tkt3935.test.lua +++ b/test/sql-tap/tkt3935.test.lua @@ -57,7 +57,7 @@ test:do_catchsql_test( SELECT a FROM (t1) AS t ON b USING(a) ]], { -- - 1, "a JOIN clause is required before ON" + 1, "Syntax error in FROM clause: a JOIN clause is required before ON and USING" -- }) @@ -67,7 +67,7 @@ test:do_catchsql_test( SELECT a FROM (t1) AS t ON b ]], { -- - 1, "a JOIN clause is required before ON" + 1, "Syntax error in FROM clause: a JOIN clause is required before ON and USING" -- }) @@ -77,7 +77,7 @@ test:do_catchsql_test( SELECT a FROM (SELECT * FROM t1) AS t ON b USING(a) ]], { -- - 1, "a JOIN clause is required before ON" + 1, "Syntax error in FROM clause: a JOIN clause is required before ON and USING" -- }) @@ -87,7 +87,7 @@ test:do_catchsql_test( SELECT a FROM (SELECT * FROM t1) AS t ON b ]], { -- - 1, "a JOIN clause is required before ON" + 1, "Syntax error in FROM clause: a JOIN clause is required before ON and USING" -- }) @@ -97,7 +97,7 @@ test:do_catchsql_test( SELECT a FROM t1 AS t ON b ]], { -- - 1, "a JOIN clause is required before ON" + 1, "Syntax error in FROM clause: a JOIN clause is required before ON and USING" -- }) @@ -107,7 +107,7 @@ test:do_catchsql_test( SELECT a FROM t1 AS t ON b USING(a) ]], { -- - 1, "a JOIN clause is required before ON" + 1, "Syntax error in FROM clause: a JOIN clause is required before ON and USING" -- }) @@ -117,7 +117,7 @@ test:do_catchsql_test( SELECT a FROM t1 AS t USING(a) ]], { -- - 1, "a JOIN clause is required before USING" + 1, "Syntax error in FROM clause: a JOIN clause is required before ON and USING" -- }) diff --git a/test/sql-tap/tokenize.test.lua b/test/sql-tap/tokenize.test.lua index 9ef4fd0..b1a097e 100755 --- a/test/sql-tap/tokenize.test.lua +++ b/test/sql-tap/tokenize.test.lua @@ -26,7 +26,7 @@ test:do_catchsql_test( SELECT 1.0e+ ]], { -- - 1, [[unrecognized token: "1.0e"]] + 1, [[Syntax error: unrecognized token: '1.0e']] -- }) @@ -36,7 +36,7 @@ test:do_catchsql_test( SELECT 1.0E+ ]], { -- - 1, [[unrecognized token: "1.0E"]] + 1, [[Syntax error: unrecognized token: '1.0E']] -- }) @@ -46,7 +46,7 @@ test:do_catchsql_test( SELECT 1.0e- ]], { -- - 1, [[unrecognized token: "1.0e"]] + 1, [[Syntax error: unrecognized token: '1.0e']] -- }) @@ -56,7 +56,7 @@ test:do_catchsql_test( SELECT 1.0E- ]], { -- - 1, [[unrecognized token: "1.0E"]] + 1, [[Syntax error: unrecognized token: '1.0E']] -- }) @@ -66,7 +66,7 @@ test:do_catchsql_test( SELECT 1.0e+/ ]], { -- - 1, [[unrecognized token: "1.0e"]] + 1, [[Syntax error: unrecognized token: '1.0e']] -- }) @@ -76,7 +76,7 @@ test:do_catchsql_test( SELECT 1.0E+: ]], { -- - 1, [[unrecognized token: "1.0E"]] + 1, [[Syntax error: unrecognized token: '1.0E']] -- }) @@ -86,7 +86,7 @@ test:do_catchsql_test( SELECT 1.0e-: ]], { -- - 1, [[unrecognized token: "1.0e"]] + 1, [[Syntax error: unrecognized token: '1.0e']] -- }) @@ -96,7 +96,7 @@ test:do_catchsql_test( SELECT 1.0E-/ ]], { -- - 1, [[unrecognized token: "1.0E"]] + 1, [[Syntax error: unrecognized token: '1.0E']] -- }) @@ -106,7 +106,7 @@ test:do_catchsql_test( SELECT 1.0F+5 ]], { -- - 1, [[unrecognized token: "1.0F"]] + 1, [[Syntax error: unrecognized token: '1.0F']] -- }) @@ -116,7 +116,7 @@ test:do_catchsql_test( SELECT 1.0d-10 ]], { -- - 1, [[unrecognized token: "1.0d"]] + 1, [[Syntax error: unrecognized token: '1.0d']] -- }) @@ -126,7 +126,7 @@ test:do_catchsql_test( SELECT 1.0e,5 ]], { -- - 1, [[unrecognized token: "1.0e"]] + 1, [[Syntax error: unrecognized token: '1.0e']] -- }) @@ -136,7 +136,7 @@ test:do_catchsql_test( SELECT 1.0E.10 ]], { -- - 1, [[unrecognized token: "1.0E"]] + 1, [[Syntax error: unrecognized token: '1.0E']] -- }) @@ -145,7 +145,7 @@ test:do_catchsql_test( [[ SELECT 1, 2 /*]], { -- - 1, [[near "*": syntax error]] + 1, [[Syntax error near '*']] -- }) diff --git a/test/sql-tap/trigger1.test.lua b/test/sql-tap/trigger1.test.lua index 871a144..2984d4c 100755 --- a/test/sql-tap/trigger1.test.lua +++ b/test/sql-tap/trigger1.test.lua @@ -72,7 +72,7 @@ test:do_catchsql_test( END; ]], { -- - 1, [[near "STATEMENT": syntax error]] + 1, [[Syntax error near 'STATEMENT']] -- }) @@ -297,7 +297,7 @@ test:do_catchsql_test( END; ]], { -- - 1, [[near ";": syntax error]] + 1, [[Syntax error near ';']] -- }) @@ -310,7 +310,7 @@ test:do_catchsql_test( END; ]], { -- - 1, [[near ";": syntax error]] + 1, [[Syntax error near ';']] -- }) @@ -809,7 +809,7 @@ test:do_catchsql_test( END; ]], { -- - 1, "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers" + 1, "Syntax error in trigger body: the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers" -- }) @@ -821,7 +821,7 @@ test:do_catchsql_test( END; ]], { -- - 1, "the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers" + 1, "Syntax error in trigger body: the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers" -- }) @@ -833,7 +833,7 @@ test:do_catchsql_test( END; ]], { -- - 1, "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers" + 1, "Syntax error in trigger body: the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers" -- }) @@ -845,7 +845,7 @@ test:do_catchsql_test( END; ]], { -- - 1, "the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers" + 1, "Syntax error in trigger body: the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers" -- }) diff --git a/test/sql-tap/view.test.lua b/test/sql-tap/view.test.lua index c99a0a5..72fdab8 100755 --- a/test/sql-tap/view.test.lua +++ b/test/sql-tap/view.test.lua @@ -293,7 +293,7 @@ test:do_catchsql_test( CREATE VIEW v1err(x,y DESC,z) AS SELECT a, b+c, c-b FROM t1; ]], { -- - 1, [[keyword "DESC" is reserved]] + 1, [[Keyword 'DESC' is reserved. Please use double quotes if 'DESC' is an identifier.]] -- }) @@ -961,7 +961,7 @@ test:do_catchsql_test( DROP VIEW main.nosuchview ]], { -- - 1, "near \".\": syntax error" + 1, "Syntax error near '.'" -- }) diff --git a/test/sql-tap/with1.test.lua b/test/sql-tap/with1.test.lua index 7896483..add2345 100755 --- a/test/sql-tap/with1.test.lua +++ b/test/sql-tap/with1.test.lua @@ -178,7 +178,7 @@ test:do_catchsql_test(3.6, [[ SELECT * FROM tmp; ]], { -- <3.6> - 1, [[keyword "SELECT" is reserved]] + 1, [[Keyword 'SELECT' is reserved. Please use double quotes if 'SELECT' is an identifier.]] -- }) @@ -1018,7 +1018,7 @@ test:do_catchsql_test(13.1, [[ SELECT i FROM c; ]], { -- <13.1> - 1, "no tables specified" + 1, "Failed to expand '*' in SELECT statement without FROM clause" -- }) @@ -1027,7 +1027,7 @@ test:do_catchsql_test(13.2, [[ SELECT i FROM c; ]], { -- <13.2> - 1, "no tables specified" + 1, "Failed to expand '*' in SELECT statement without FROM clause" -- }) diff --git a/test/sql-tap/with2.test.lua b/test/sql-tap/with2.test.lua index c27a9d1..ca3f00e 100755 --- a/test/sql-tap/with2.test.lua +++ b/test/sql-tap/with2.test.lua @@ -317,7 +317,7 @@ test:do_catchsql_test(4.1, [[ SELECT * FROM x; ]], { -- <4.1> - 1, [[near ")": syntax error]] + 1, [[Syntax error near ')']] -- }) @@ -519,7 +519,7 @@ test:do_catchsql_test(6.2, [[ INSERT INTO t2 VALUES(1, 2,); ]], { -- <6.2> - 1, [[near ")": syntax error]] + 1, [[Syntax error near ')']] -- }) @@ -528,7 +528,7 @@ test:do_catchsql_test("6.3.1", [[ INSERT INTO t2 SELECT a, b, FROM t1; ]], { -- <6.3> - 1, [[keyword "FROM" is reserved]] + 1, [[Keyword 'FROM' is reserved. Please use double quotes if 'FROM' is an identifier.]] -- }) @@ -546,7 +546,7 @@ test:do_catchsql_test(6.4, [[ INSERT INTO t2 SELECT a, b, FROM t1 a a a; ]], { -- <6.4> - 1, [[keyword "FROM" is reserved]] + 1, [[Keyword 'FROM' is reserved. Please use double quotes if 'FROM' is an identifier.]] -- }) @@ -555,7 +555,7 @@ test:do_catchsql_test(6.5, [[ DELETE FROM t2 WHERE; ]], { -- <6.5> - 1, [[near ";": syntax error]] + 1, [[Syntax error near ';']] -- }) @@ -563,7 +563,7 @@ test:do_catchsql_test(6.6, [[ WITH x AS (SELECT * FROM t1) DELETE FROM t2 WHERE ]], { -- <6.6> - 1, '/near .* syntax error/' + 1, "Syntax error near '\n'" -- }) @@ -571,7 +571,7 @@ test:do_catchsql_test(6.7, [[ WITH x AS (SELECT * FROM t1) DELETE FROM t2 WHRE 1; ]], { -- <6.7> - 1, '/near .* syntax error/' + 1, "Syntax error near 'WHRE'" -- }) @@ -579,7 +579,7 @@ test:do_catchsql_test(6.8, [[ WITH x AS (SELECT * FROM t1) UPDATE t2 SET a = 10, b = ; ]], { -- <6.8> - 1, '/near .* syntax error/' + 1, "Syntax error near ';'" -- }) @@ -587,7 +587,7 @@ test:do_catchsql_test(6.9, [[ WITH x AS (SELECT * FROM t1) UPDATE t2 SET a = 10, b = 1 WHERE a===b; ]], { -- <6.9> - 1, '/near .* syntax error/' + 1, "Syntax error near '='" -- }) diff --git a/test/sql/checks.result b/test/sql/checks.result index 2eafae8..e31964c 100644 --- a/test/sql/checks.result +++ b/test/sql/checks.result @@ -30,7 +30,7 @@ t = {513, 1, 'test', 'memtx', 0, opts, format} s = box.space._space:insert(t) --- - error: 'Wrong space options (field 5): invalid expression specified (SQL error: - near "<": syntax error)' + Syntax error near ''<'')' ... opts = {checks = {{expr = 'X>5'}}} --- diff --git a/test/sql/collation.result b/test/sql/collation.result index faa9f81..3794990 100644 --- a/test/sql/collation.result +++ b/test/sql/collation.result @@ -14,23 +14,23 @@ box.sql.execute('pragma sql_default_engine=\''..engine..'\'') -- All of these tests should throw error "near "COLLATE": syntax error" box.sql.execute("SELECT 1 LIMIT 1 COLLATE BINARY;") --- -- error: 'near "COLLATE": syntax error' +- error: Syntax error near 'COLLATE' ... box.sql.execute("SELECT 1 LIMIT 1 COLLATE BINARY OFFSET 1;") --- -- error: 'near "COLLATE": syntax error' +- error: Syntax error near 'COLLATE' ... box.sql.execute("SELECT 1 LIMIT 1 OFFSET 1 COLLATE BINARY;") --- -- error: 'near "COLLATE": syntax error' +- error: Syntax error near 'COLLATE' ... box.sql.execute("SELECT 1 LIMIT 1, 1 COLLATE BINARY;") --- -- error: 'near "COLLATE": syntax error' +- error: Syntax error near 'COLLATE' ... box.sql.execute("SELECT 1 LIMIT 1 COLLATE BINARY, 1;") --- -- error: 'near "COLLATE": syntax error' +- error: Syntax error near 'COLLATE' ... -- gh-3052: upper/lower support only default locale -- For tr-TR result depends on collation @@ -102,7 +102,7 @@ cn = remote.connect(box.cfg.listen) ... cn:execute('select 1 limit ? collate not_exist', {1}) --- -- error: 'Failed to execute SQL statement: near "COLLATE": syntax error' +- error: 'Failed to execute SQL statement: Syntax error near ''COLLATE''' ... cn:close() --- diff --git a/test/sql/foreign-keys.result b/test/sql/foreign-keys.result index becb4c2..3c6464e 100644 --- a/test/sql/foreign-keys.result +++ b/test/sql/foreign-keys.result @@ -358,19 +358,21 @@ box.sql.execute('CREATE TABLE t1 (id INT PRIMARY KEY);') ... box.sql.execute('CREATE TABLE t2 (id INT PRIMARY KEY REFERENCES t2 ON DELETE CASCADE ON DELETE RESTRICT);') --- -- error: keyword "DELETE" is reserved +- error: Keyword 'DELETE' is reserved. Please use double quotes if 'DELETE' is an + identifier. ... box.sql.execute('CREATE TABLE t2 (id INT PRIMARY KEY REFERENCES t2 ON DELETE CASCADE ON DELETE CASCADE);') --- -- error: keyword "DELETE" is reserved +- error: Keyword 'DELETE' is reserved. Please use double quotes if 'DELETE' is an + identifier. ... box.sql.execute('CREATE TABLE t2 (id INT PRIMARY KEY REFERENCES t2 ON DELETE CASCADE ON UPDATE RESTRICT ON DELETE RESTRICT);') --- -- error: keyword "ON" is reserved +- error: Keyword 'ON' is reserved. Please use double quotes if 'ON' is an identifier. ... box.sql.execute('CREATE TABLE t2 (id INT PRIMARY KEY REFERENCES t2 ON DELETE CASCADE MATCH FULL);') --- -- error: keyword "MATCH" is reserved +- error: Keyword 'MATCH' is reserved. Please use double quotes if 'MATCH' is an identifier. ... box.space.T1:drop() --- diff --git a/test/sql/gh-3888-values-blob-assert.result b/test/sql/gh-3888-values-blob-assert.result index 8deded7..611c10d 100644 --- a/test/sql/gh-3888-values-blob-assert.result +++ b/test/sql/gh-3888-values-blob-assert.result @@ -16,20 +16,20 @@ box.sql.execute('pragma sql_default_engine=\''..engine..'\'') -- check 'VALUES' against typedef keywords (should fail) box.sql.execute('VALUES(scalar)') --- -- error: 'near "scalar": syntax error' +- error: Syntax error near 'scalar' ... box.sql.execute('VALUES(float)') --- -- error: 'near "float": syntax error' +- error: Syntax error near 'float' ... -- check 'SELECT' against typedef keywords (should fail) box.sql.execute('SELECT scalar') --- -- error: 'near "scalar": syntax error' +- error: Syntax error near 'scalar' ... box.sql.execute('SELECT float') --- -- error: 'near "float": syntax error' +- error: Syntax error near 'float' ... -- check 'VALUES' against ID (should fail) box.sql.execute('VALUES(TheColumnName)') diff --git a/test/sql/iproto.result b/test/sql/iproto.result index da7b40f..938aea9 100644 --- a/test/sql/iproto.result +++ b/test/sql/iproto.result @@ -96,7 +96,7 @@ cn:execute('insert into not_existing_table values ("kek")') ... cn:execute('insert qwerty gjsdjq q qwd qmq;; q;qwd;') --- -- error: 'Failed to execute SQL statement: near "qwerty": syntax error' +- error: 'Failed to execute SQL statement: Syntax error near ''qwerty''' ... -- Empty result. cn:execute('select id as identifier from test where a = 5;') @@ -109,7 +109,7 @@ cn:execute('select id as identifier from test where a = 5;') -- netbox API errors. cn:execute(100) --- -- error: 'Failed to execute SQL statement: near "100": syntax error' +- error: 'Failed to execute SQL statement: Syntax error near ''100''' ... cn:execute('select 1', nil, {dry_run = true}) --- @@ -118,11 +118,11 @@ cn:execute('select 1', nil, {dry_run = true}) -- Empty request. cn:execute('') --- -- error: 'Failed to execute SQL statement: syntax error: empty request' +- error: 'Failed to execute SQL statement: Failed to execute an empty SQL statement' ... cn:execute(' ;') --- -- error: 'Failed to execute SQL statement: syntax error: empty request' +- error: 'Failed to execute SQL statement: Failed to execute an empty SQL statement' ... -- -- gh-3467: allow only positive integers under limit clause. @@ -567,7 +567,7 @@ cn:execute('drop table if exists test3') -- cn:execute('select ?1, ?2, ?3', {1, 2, 3}) --- -- error: 'Failed to execute SQL statement: near "?1": syntax error' +- error: 'Failed to execute SQL statement: Syntax error near ''?1''' ... cn:execute('select $name, $name2', {1, 2}) --- diff --git a/test/sql/misc.result b/test/sql/misc.result index ef104c1..9a8aa8d 100644 --- a/test/sql/misc.result +++ b/test/sql/misc.result @@ -14,11 +14,13 @@ box.sql.execute('select 1;') ... box.sql.execute('select 1; select 2;') --- -- error: keyword "select" is reserved +- error: Keyword 'select' is reserved. Please use double quotes if 'select' is an + identifier. ... box.sql.execute('create table t1 (id INT primary key); select 100;') --- -- error: keyword "select" is reserved +- error: Keyword 'select' is reserved. Please use double quotes if 'select' is an + identifier. ... box.space.t1 == nil --- @@ -26,17 +28,17 @@ box.space.t1 == nil ... box.sql.execute(';') --- -- error: 'syntax error: empty request' +- error: Failed to execute an empty SQL statement ... box.sql.execute('') --- -- error: 'syntax error: empty request' +- error: Failed to execute an empty SQL statement ... box.sql.execute(' ;') --- -- error: 'syntax error: empty request' +- error: Failed to execute an empty SQL statement ... box.sql.execute('\n\n\n\t\t\t ') --- -- error: 'syntax error: empty request' +- error: Failed to execute an empty SQL statement ... diff --git a/test/sql/on-conflict.result b/test/sql/on-conflict.result index 07bb403..6d37e69 100644 --- a/test/sql/on-conflict.result +++ b/test/sql/on-conflict.result @@ -13,37 +13,37 @@ box.sql.execute('pragma sql_default_engine=\''..engine..'\'') -- box.sql.execute("CREATE TABLE t (id INTEGER PRIMARY KEY, v INTEGER UNIQUE ON CONFLICT ABORT)") --- -- error: keyword "ON" is reserved +- error: Keyword 'ON' is reserved. Please use double quotes if 'ON' is an identifier. ... box.sql.execute("CREATE TABLE q (id INTEGER PRIMARY KEY, v INTEGER UNIQUE ON CONFLICT FAIL)") --- -- error: keyword "ON" is reserved +- error: Keyword 'ON' is reserved. Please use double quotes if 'ON' is an identifier. ... box.sql.execute("CREATE TABLE p (id INTEGER PRIMARY KEY, v INTEGER UNIQUE ON CONFLICT IGNORE)") --- -- error: keyword "ON" is reserved +- error: Keyword 'ON' is reserved. Please use double quotes if 'ON' is an identifier. ... box.sql.execute("CREATE TABLE g (id INTEGER PRIMARY KEY, v INTEGER UNIQUE ON CONFLICT REPLACE)") --- -- error: keyword "ON" is reserved +- error: Keyword 'ON' is reserved. Please use double quotes if 'ON' is an identifier. ... box.sql.execute("CREATE TABLE e (id INTEGER PRIMARY KEY ON CONFLICT REPLACE, v INTEGER)") --- -- error: keyword "ON" is reserved +- error: Keyword 'ON' is reserved. Please use double quotes if 'ON' is an identifier. ... box.sql.execute("CREATE TABLE t1(a INT PRIMARY KEY ON CONFLICT REPLACE)") --- -- error: keyword "ON" is reserved +- error: Keyword 'ON' is reserved. Please use double quotes if 'ON' is an identifier. ... box.sql.execute("CREATE TABLE t2(a INT PRIMARY KEY ON CONFLICT IGNORE)") --- -- error: keyword "ON" is reserved +- error: Keyword 'ON' is reserved. Please use double quotes if 'ON' is an identifier. ... -- CHECK constraint is illegal with REPLACE option. -- box.sql.execute("CREATE TABLE t (id INTEGER PRIMARY KEY, a INTEGER CHECK (a > 5) ON CONFLICT REPLACE);") --- -- error: keyword "ON" is reserved +- error: Keyword 'ON' is reserved. Please use double quotes if 'ON' is an identifier. ... -- -- gh-3473: Primary key can't be declared with NULL. diff --git a/test/sql/types.result b/test/sql/types.result index 11b045c..1220cc0 100644 --- a/test/sql/types.result +++ b/test/sql/types.result @@ -8,23 +8,26 @@ test_run = env.new() -- box.sql.execute("CREATE TABLE t1 (id PRIMARY KEY);") --- -- error: keyword "PRIMARY" is reserved +- error: Keyword 'PRIMARY' is reserved. Please use double quotes if 'PRIMARY' is an + identifier. ... box.sql.execute("CREATE TABLE t1 (a, id INT PRIMARY KEY);") --- -- error: 'near ",": syntax error' +- error: Syntax error near ',' ... box.sql.execute("CREATE TABLE t1 (id PRIMARY KEY, a INT);") --- -- error: keyword "PRIMARY" is reserved +- error: Keyword 'PRIMARY' is reserved. Please use double quotes if 'PRIMARY' is an + identifier. ... box.sql.execute("CREATE TABLE t1 (id INT PRIMARY KEY, a);") --- -- error: 'near ")": syntax error' +- error: Syntax error near ')' ... box.sql.execute("CREATE TABLE t1 (id INT PRIMARY KEY, a INT, b UNIQUE);") --- -- error: keyword "UNIQUE" is reserved +- error: Keyword 'UNIQUE' is reserved. Please use double quotes if 'UNIQUE' is an + identifier. ... -- gh-3104: real type is stored in space format. -- -- 2.7.4