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 B21C124DFD for ; Fri, 23 Aug 2019 11:02:14 -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 L8td-coJBFLm for ; Fri, 23 Aug 2019 11:02:14 -0400 (EDT) Received: from smtp39.i.mail.ru (smtp39.i.mail.ru [94.100.177.99]) (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 EACC424DEA for ; Fri, 23 Aug 2019 11:02:13 -0400 (EDT) Subject: [tarantool-patches] [PATCH v4 3/5] sql: remove name overloading for SQL builtins References: <154ee8ea11ae260254b71d32e1299f1272438af1.1566400979.git.kshcherbatov@tarantool.org> <17C6E71F-24DF-476D-B5FA-430AF34DC84D@tarantool.org> From: Kirill Shcherbatov Message-ID: <6c04c60a-8ae6-d1bf-0d67-943f39bd3b81@tarantool.org> Date: Fri, 23 Aug 2019 18:02:12 +0300 MIME-Version: 1.0 In-Reply-To: <17C6E71F-24DF-476D-B5FA-430AF34DC84D@tarantool.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US 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: tarantool-patches@freelists.org, "n.pettik" Now all SQL builtins are unique, i.e. each function has the only hash table entry. This technique requires to remove static argc checks for some builtins(substr, round, like, trim, count, group_concat). Now they raise a runtime error in case of invalid usage. Updated error messages correspondingly, to provide more informative messages in such cases. Taking into account upcoming changes, all built-in functions names are uppercased. Needed for #2200, #4113, #2233 --- src/box/errcode.h | 1 + src/box/sql/expr.c | 18 ++++- src/box/sql/func.c | 126 ++++++++++++++++++-------------- src/box/sql/resolve.c | 24 +++--- test/box/misc.result | 1 + test/sql-tap/func.test.lua | 22 +++--- test/sql-tap/func2.test.lua | 18 ++--- test/sql-tap/limit.test.lua | 4 +- test/sql-tap/select1.test.lua | 12 +-- test/sql-tap/where2.test.lua | 4 +- test/sql/icu-upper-lower.result | 4 +- 11 files changed, 130 insertions(+), 104 deletions(-) diff --git a/src/box/errcode.h b/src/box/errcode.h index 46b0b365a..18574c5aa 100644 --- a/src/box/errcode.h +++ b/src/box/errcode.h @@ -253,6 +253,7 @@ struct errcode_record { /*198 */_(ER_FUNC_INDEX_FUNC, "Failed to build a key for functional index '%s' of space '%s': %s") \ /*199 */_(ER_FUNC_INDEX_FORMAT, "Key format doesn't match one defined in functional index '%s' of space '%s': %s") \ /*200 */_(ER_FUNC_INDEX_PARTS, "Wrong functional index definition: %s") \ + /*201 */_(ER_FUNC_WRONG_ARG_COUNT, "Wrong number of arguments is passed to %s(): expected %s, got %d") \ /* * !IMPORTANT! Please follow instructions at start of the file diff --git a/src/box/sql/expr.c b/src/box/sql/expr.c index 1f9d91705..1837817d6 100644 --- a/src/box/sql/expr.c +++ b/src/box/sql/expr.c @@ -4004,7 +4004,14 @@ sqlExprCodeTarget(Parse * pParse, Expr * pExpr, int target) */ if (pDef->funcFlags & SQL_FUNC_COALESCE) { int endCoalesce = sqlVdbeMakeLabel(v); - assert(nFarg >= 2); + if (nFarg < 2) { + diag_set(ClientError, + ER_FUNC_WRONG_ARG_COUNT, + pDef->zName, "at least two", + nFarg); + pParse->is_aborted = true; + break; + } sqlExprCode(pParse, pFarg->a[0].pExpr, target); for (i = 1; i < nFarg; i++) { @@ -4027,7 +4034,14 @@ sqlExprCodeTarget(Parse * pParse, Expr * pExpr, int target) * of the first argument. */ if (pDef->funcFlags & SQL_FUNC_UNLIKELY) { - assert(nFarg >= 1); + if (nFarg < 1) { + diag_set(ClientError, + ER_FUNC_WRONG_ARG_COUNT, + pDef->zName, "at least one", + nFarg); + pParse->is_aborted = true; + break; + } return sqlExprCodeTarget(pParse, pFarg->a[0].pExpr, target); diff --git a/src/box/sql/func.c b/src/box/sql/func.c index a46df60ed..9ce645698 100644 --- a/src/box/sql/func.c +++ b/src/box/sql/func.c @@ -410,7 +410,12 @@ substrFunc(sql_context * context, int argc, sql_value ** argv) i64 p1, p2; int negP2 = 0; - assert(argc == 3 || argc == 2); + if (argc != 2 && argc != 3) { + diag_set(ClientError, ER_FUNC_WRONG_ARG_COUNT, "SUBSTR", + "1 or 2", argc); + context->is_aborted = true; + return; + } if (sql_value_is_null(argv[1]) || (argc == 3 && sql_value_is_null(argv[2])) ) { @@ -506,7 +511,12 @@ roundFunc(sql_context * context, int argc, sql_value ** argv) { int n = 0; double r; - assert(argc == 1 || argc == 2); + if (argc != 1 && argc != 2) { + diag_set(ClientError, ER_FUNC_WRONG_ARG_COUNT, "ROUND", + "1 or 2", argc); + context->is_aborted = true; + return; + } if (argc == 2) { if (sql_value_is_null(argv[1])) return; @@ -898,6 +908,12 @@ likeFunc(sql_context *context, int argc, sql_value **argv) { u32 escape = SQL_END_OF_STRING; int nPat; + if (argc != 2 && argc != 3) { + diag_set(ClientError, ER_FUNC_WRONG_ARG_COUNT, + "LIKE", "2 or 3", argc); + context->is_aborted = true; + return; + } sql *db = sql_context_db_handle(context); int rhs_type = sql_value_type(argv[0]); int lhs_type = sql_value_type(argv[1]); @@ -1510,7 +1526,9 @@ trim_func(struct sql_context *context, int argc, sql_value **argv) trim_func_three_args(context, argv[0], argv[1], argv[2]); break; default: - unreachable(); + diag_set(ClientError, ER_FUNC_WRONG_ARG_COUNT, "TRIM", + "1 or 2 or 3", argc); + context->is_aborted = true; } } @@ -1689,6 +1707,12 @@ static void countStep(sql_context * context, int argc, sql_value ** argv) { CountCtx *p; + if (argc != 0 && argc != 1) { + diag_set(ClientError, ER_FUNC_WRONG_ARG_COUNT, + "COUNT", "0 or 1", argc); + context->is_aborted = true; + return; + } p = sql_aggregate_context(context, sizeof(*p)); if ((argc == 0 || ! sql_value_is_null(argv[0])) && p) { p->n++; @@ -1765,7 +1789,12 @@ groupConcatStep(sql_context * context, int argc, sql_value ** argv) StrAccum *pAccum; const char *zSep; int nVal, nSep; - assert(argc == 1 || argc == 2); + if (argc != 1 && argc != 2) { + diag_set(ClientError, ER_FUNC_WRONG_ARG_COUNT, + "GROUP_CONCAT", "1 or 2", argc); + context->is_aborted = true; + return; + } if (sql_value_is_null(argv[0])) return; pAccum = @@ -1848,75 +1877,62 @@ sqlRegisterBuiltinFunctions(void) * For peak efficiency, put the most frequently used function last. */ static FuncDef aBuiltinFunc[] = { - FUNCTION(soundex, 1, 0, 0, soundexFunc, FIELD_TYPE_STRING), - FUNCTION2(unlikely, 1, 0, 0, noopFunc, SQL_FUNC_UNLIKELY, + FUNCTION(SOUNDEX, 1, 0, 0, soundexFunc, FIELD_TYPE_STRING), + FUNCTION2(UNLIKELY, 1, 0, 0, noopFunc, SQL_FUNC_UNLIKELY, FIELD_TYPE_BOOLEAN), - FUNCTION2(likelihood, 2, 0, 0, noopFunc, SQL_FUNC_UNLIKELY, + FUNCTION2(LIKELIHOOD, 2, 0, 0, noopFunc, SQL_FUNC_UNLIKELY, FIELD_TYPE_BOOLEAN), - FUNCTION2(likely, 1, 0, 0, noopFunc, SQL_FUNC_UNLIKELY, + FUNCTION2(LIKELY, 1, 0, 0, noopFunc, SQL_FUNC_UNLIKELY, FIELD_TYPE_BOOLEAN), - FUNCTION_COLL(trim, 1, 3, 0, trim_func), - FUNCTION_COLL(trim, 2, 3, 0, trim_func), - FUNCTION_COLL(trim, 3, 3, 0, trim_func), - FUNCTION2(least, -1, 0, 1, minmaxFunc, SQL_FUNC_MIN, + FUNCTION_COLL(TRIM, -1, 3, 0, trim_func), + FUNCTION2(LEAST, -1, 0, 1, minmaxFunc, SQL_FUNC_MIN, FIELD_TYPE_SCALAR), - AGGREGATE2(min, 1, 0, 1, minmaxStep, minMaxFinalize, + AGGREGATE2(MIN, 1, 0, 1, minmaxStep, minMaxFinalize, SQL_FUNC_MIN, FIELD_TYPE_SCALAR), FUNCTION2(greatest, -1, 1, 1, minmaxFunc, SQL_FUNC_MAX, FIELD_TYPE_SCALAR), - AGGREGATE2(max, 1, 1, 1, minmaxStep, minMaxFinalize, + AGGREGATE2(MAX, 1, 1, 1, minmaxStep, minMaxFinalize, SQL_FUNC_MAX, FIELD_TYPE_SCALAR), - FUNCTION2(typeof, 1, 0, 0, typeofFunc, SQL_FUNC_TYPEOF, + FUNCTION2(TYPEOF, 1, 0, 0, typeofFunc, SQL_FUNC_TYPEOF, FIELD_TYPE_STRING), - FUNCTION2(length, 1, 0, 0, lengthFunc, SQL_FUNC_LENGTH, + FUNCTION2(LENGTH, 1, 0, 0, lengthFunc, SQL_FUNC_LENGTH, FIELD_TYPE_INTEGER), - FUNCTION(char_length, 1, 0, 0, lengthFunc, FIELD_TYPE_INTEGER), - FUNCTION(character_length, 1, 0, 0, lengthFunc, + FUNCTION(CHAR_LENGTH, 1, 0, 0, lengthFunc, FIELD_TYPE_INTEGER), + FUNCTION(CHARACTER_LENGTH, 1, 0, 0, lengthFunc, FIELD_TYPE_INTEGER), - FUNCTION(position, 2, 0, 1, position_func, FIELD_TYPE_INTEGER), - FUNCTION(printf, -1, 0, 0, printfFunc, FIELD_TYPE_STRING), - FUNCTION(unicode, 1, 0, 0, unicodeFunc, FIELD_TYPE_STRING), - FUNCTION(char, -1, 0, 0, charFunc, FIELD_TYPE_STRING), - FUNCTION(abs, 1, 0, 0, absFunc, FIELD_TYPE_NUMBER), - FUNCTION(round, 1, 0, 0, roundFunc, FIELD_TYPE_INTEGER), - FUNCTION(round, 2, 0, 0, roundFunc, FIELD_TYPE_INTEGER), - FUNCTION_COLL(upper, 1, 0, 1, UpperICUFunc), - FUNCTION_COLL(lower, 1, 0, 1, LowerICUFunc), - FUNCTION(hex, 1, 0, 0, hexFunc, FIELD_TYPE_STRING), - FUNCTION2(ifnull, 2, 0, 0, noopFunc, SQL_FUNC_COALESCE, + FUNCTION(POSITION, 2, 0, 1, position_func, FIELD_TYPE_INTEGER), + FUNCTION(PRINTF, -1, 0, 0, printfFunc, FIELD_TYPE_STRING), + FUNCTION(UNICODE, 1, 0, 0, unicodeFunc, FIELD_TYPE_STRING), + FUNCTION(CHAR, -1, 0, 0, charFunc, FIELD_TYPE_STRING), + FUNCTION(ABS, 1, 0, 0, absFunc, FIELD_TYPE_NUMBER), + FUNCTION(ROUND, -1, 0, 0, roundFunc, FIELD_TYPE_INTEGER), + FUNCTION_COLL(UPPER, 1, 0, 1, UpperICUFunc), + FUNCTION_COLL(LOWER, 1, 0, 1, LowerICUFunc), + FUNCTION(HEX, 1, 0, 0, hexFunc, FIELD_TYPE_STRING), + FUNCTION2(IFNULL, 2, 0, 0, noopFunc, SQL_FUNC_COALESCE, FIELD_TYPE_INTEGER), - VFUNCTION(random, 0, 0, 0, randomFunc, FIELD_TYPE_INTEGER), - VFUNCTION(randomblob, 1, 0, 0, randomBlob, FIELD_TYPE_VARBINARY), - FUNCTION(nullif, 2, 0, 1, nullifFunc, FIELD_TYPE_SCALAR), - FUNCTION(version, 0, 0, 0, sql_func_version, FIELD_TYPE_STRING), - FUNCTION(quote, 1, 0, 0, quoteFunc, FIELD_TYPE_STRING), - VFUNCTION(row_count, 0, 0, 0, sql_row_count, FIELD_TYPE_INTEGER), - FUNCTION_COLL(replace, 3, 0, 0, replaceFunc), - FUNCTION(zeroblob, 1, 0, 0, zeroblobFunc, FIELD_TYPE_VARBINARY), - FUNCTION_COLL(substr, 2, 0, 0, substrFunc), - FUNCTION_COLL(substr, 3, 0, 0, substrFunc), - AGGREGATE(sum, 1, 0, 0, sum_step, sumFinalize, + VFUNCTION(RANDOM, 0, 0, 0, randomFunc, FIELD_TYPE_INTEGER), + VFUNCTION(RANDOMBLOB, 1, 0, 0, randomBlob, FIELD_TYPE_VARBINARY), + FUNCTION(NULLIF, 2, 0, 1, nullifFunc, FIELD_TYPE_SCALAR), + FUNCTION(VERSION, 0, 0, 0, sql_func_version, FIELD_TYPE_STRING), + FUNCTION(QUOTE, 1, 0, 0, quoteFunc, FIELD_TYPE_STRING), + VFUNCTION(ROW_COUNT, 0, 0, 0, sql_row_count, FIELD_TYPE_INTEGER), + FUNCTION_COLL(REPLACE, 3, 0, 0, replaceFunc), + FUNCTION(ZEROBLOB, 1, 0, 0, zeroblobFunc, FIELD_TYPE_VARBINARY), + FUNCTION_COLL(SUBSTR, -1, 0, 0, substrFunc), + AGGREGATE(SUM, 1, 0, 0, sum_step, sumFinalize, FIELD_TYPE_NUMBER), - AGGREGATE(total, 1, 0, 0, sum_step, totalFinalize, + AGGREGATE(TOTAL, 1, 0, 0, sum_step, totalFinalize, FIELD_TYPE_NUMBER), - AGGREGATE(avg, 1, 0, 0, sum_step, avgFinalize, + AGGREGATE(AVG, 1, 0, 0, sum_step, avgFinalize, FIELD_TYPE_NUMBER), - AGGREGATE2(count, 0, 0, 0, countStep, countFinalize, + AGGREGATE2(COUNT, -1, 0, 0, countStep, countFinalize, SQL_FUNC_COUNT, FIELD_TYPE_INTEGER), - AGGREGATE2(count, 1, 0, 0, countStep, countFinalize, - SQL_FUNC_COUNT, FIELD_TYPE_INTEGER), - AGGREGATE(group_concat, 1, 0, 0, groupConcatStep, + AGGREGATE(GROUP_CONCAT, -1, 0, 0, groupConcatStep, groupConcatFinalize, FIELD_TYPE_STRING), - AGGREGATE(group_concat, 2, 0, 0, groupConcatStep, - groupConcatFinalize, FIELD_TYPE_STRING), - - LIKEFUNC(like, 2, 1, SQL_FUNC_LIKE, - FIELD_TYPE_INTEGER), - LIKEFUNC(like, 3, 1, SQL_FUNC_LIKE, + LIKEFUNC(LIKE, -1, 1, SQL_FUNC_LIKE, FIELD_TYPE_INTEGER), - FUNCTION(coalesce, 1, 0, 0, 0, FIELD_TYPE_SCALAR), - FUNCTION(coalesce, 0, 0, 0, 0, FIELD_TYPE_SCALAR), - FUNCTION2(coalesce, -1, 0, 0, noopFunc, SQL_FUNC_COALESCE, + FUNCTION2(COALESCE, -1, 0, 0, noopFunc, SQL_FUNC_COALESCE, FIELD_TYPE_SCALAR), }; sql_register_analyze_builtins(); diff --git a/src/box/sql/resolve.c b/src/box/sql/resolve.c index 83dff47b6..853d42b58 100644 --- a/src/box/sql/resolve.c +++ b/src/box/sql/resolve.c @@ -591,8 +591,6 @@ resolveExprStep(Walker * pWalker, Expr * pExpr) case TK_FUNCTION:{ ExprList *pList = pExpr->x.pList; /* The argument list */ int n = pList ? pList->nExpr : 0; /* Number of arguments */ - int no_such_func = 0; /* True if no such function exists */ - int wrong_num_args = 0; /* True if wrong number of arguments */ int is_agg = 0; /* True if is an aggregate function */ int nId; /* Number of characters in function name */ const char *zId; /* The function name. */ @@ -606,10 +604,17 @@ resolveExprStep(Walker * pWalker, Expr * pExpr) pDef = sqlFindFunction(pParse->db, zId, -2,0); if (pDef == 0) { - no_such_func = 1; + diag_set(ClientError, + ER_NO_SUCH_FUNCTION, zId); } else { - wrong_num_args = 1; + uint32_t argc = pDef->nArg; + const char *err = tt_sprintf("%d", argc); + diag_set(ClientError, + ER_FUNC_WRONG_ARG_COUNT, + pDef->zName, err, n); } + pParse->is_aborted = true; + pNC->nErr++; } else { is_agg = pDef->xFinalize != 0; pExpr->type = pDef->ret_type; @@ -671,17 +676,6 @@ resolveExprStep(Walker * pWalker, Expr * pExpr) pParse->is_aborted = true; pNC->nErr++; is_agg = 0; - } else if (no_such_func && pParse->db->init.busy == 0) { - diag_set(ClientError, ER_NO_SUCH_FUNCTION, zId); - pParse->is_aborted = true; - pNC->nErr++; - } else if (wrong_num_args) { - const char *err = "wrong number of arguments "\ - "to function %.*s()"; - diag_set(ClientError, ER_SQL_PARSER_GENERIC, - tt_sprintf(err, nId, zId)); - pParse->is_aborted = true; - pNC->nErr++; } if (is_agg) pNC->ncFlags &= ~NC_AllowAgg; diff --git a/test/box/misc.result b/test/box/misc.result index 287d84e5b..e4de2e9b3 100644 --- a/test/box/misc.result +++ b/test/box/misc.result @@ -530,6 +530,7 @@ t; 198: box.error.FUNC_INDEX_FUNC 199: box.error.FUNC_INDEX_FORMAT 200: box.error.FUNC_INDEX_PARTS + 201: box.error.FUNC_WRONG_ARG_COUNT ... test_run:cmd("setopt delimiter ''"); --- diff --git a/test/sql-tap/func.test.lua b/test/sql-tap/func.test.lua index ec06c903d..a96fc611e 100755 --- a/test/sql-tap/func.test.lua +++ b/test/sql-tap/func.test.lua @@ -69,7 +69,7 @@ test:do_catchsql_test( SELECT length(*) FROM tbl1 ORDER BY t1 ]], { -- - 1, "wrong number of arguments to function LENGTH()" + 1, "Wrong number of arguments is passed to LENGTH(): expected 1, got 0" -- }) @@ -79,7 +79,7 @@ test:do_catchsql_test( SELECT length(t1,5) FROM tbl1 ORDER BY t1 ]], { -- - 1, "wrong number of arguments to function LENGTH()" + 1, "Wrong number of arguments is passed to LENGTH(): expected 1, got 2" -- }) @@ -365,7 +365,7 @@ test:do_test( return test:catchsql("SELECT abs(a,b) FROM t1") end, { -- - 1, "wrong number of arguments to function ABS()" + 1, "Wrong number of arguments is passed to ABS(): expected 1, got 2" -- }) @@ -377,7 +377,7 @@ test:do_catchsql_test( SELECT abs() FROM t1 ]], { -- - 1, "wrong number of arguments to function ABS()" + 1, "Wrong number of arguments is passed to ABS(): expected 1, got 0" -- }) @@ -428,7 +428,7 @@ test:do_catchsql_test( SELECT round(a,b,c) FROM t1 ]], { -- - 1, "wrong number of arguments to function ROUND()" + 1, "Wrong number of arguments is passed to ROUND(): expected 1 or 2, got 3" -- }) @@ -488,7 +488,7 @@ test:do_catchsql_test( SELECT round() FROM t1 ORDER BY a ]], { -- - 1, "wrong number of arguments to function ROUND()" + 1, "Wrong number of arguments is passed to ROUND(): expected 1 or 2, got 0" -- }) @@ -778,7 +778,7 @@ test:do_catchsql_test( SELECT upper(*) FROM t2 ]], { -- - 1, "wrong number of arguments to function UPPER()" + 1, "Wrong number of arguments is passed to UPPER(): expected 1, got 0" -- }) @@ -1782,7 +1782,7 @@ test:do_catchsql_test( SELECT replace(1,2); ]], { -- - 1, "wrong number of arguments to function REPLACE()" + 1, "Wrong number of arguments is passed to REPLACE(): expected 3, got 2" -- }) @@ -1792,7 +1792,7 @@ test:do_catchsql_test( SELECT replace(1,2,3,4); ]], { -- - 1, "wrong number of arguments to function REPLACE()" + 1, "Wrong number of arguments is passed to REPLACE(): expected 3, got 4" -- }) @@ -2540,7 +2540,7 @@ test:do_catchsql_test( SELECT coalesce() ]], { -- - 1, "wrong number of arguments to function COALESCE()" + 1, "Wrong number of arguments is passed to COALESCE(): expected at least two, got 0" -- }) @@ -2550,7 +2550,7 @@ test:do_catchsql_test( SELECT coalesce(1) ]], { -- - 1, "wrong number of arguments to function COALESCE()" + 1, "Wrong number of arguments is passed to COALESCE(): expected at least two, got 1" -- }) diff --git a/test/sql-tap/func2.test.lua b/test/sql-tap/func2.test.lua index b70197d09..c9bd3665f 100755 --- a/test/sql-tap/func2.test.lua +++ b/test/sql-tap/func2.test.lua @@ -50,7 +50,7 @@ test:do_catchsql_test( SELECT SUBSTR() ]], { -- - 1, "wrong number of arguments to function SUBSTR()" + 1, "Wrong number of arguments is passed to SUBSTR(): expected 1 or 2, got 0" -- }) @@ -60,7 +60,7 @@ test:do_catchsql_test( SELECT SUBSTR('Supercalifragilisticexpialidocious') ]], { -- - 1, "wrong number of arguments to function SUBSTR()" + 1, "Wrong number of arguments is passed to SUBSTR(): expected 1 or 2, got 1" -- }) @@ -70,7 +70,7 @@ test:do_catchsql_test( SELECT SUBSTR('Supercalifragilisticexpialidocious', 1,1,1) ]], { -- - 1, "wrong number of arguments to function SUBSTR()" + 1, "Wrong number of arguments is passed to SUBSTR(): expected 1 or 2, got 4" -- }) @@ -673,7 +673,7 @@ if ("ሴ" ~= "u1234") SELECT SUBSTR() ]], { -- - 1, "wrong number of arguments to function SUBSTR()" + 1, "Wrong number of arguments is passed to SUBSTR(): expected 1 or 2, got 0" -- }) @@ -683,7 +683,7 @@ if ("ሴ" ~= "u1234") SELECT SUBSTR('hiሴho') ]], { -- - 1, "wrong number of arguments to function SUBSTR()" + 1, "Wrong number of arguments is passed to SUBSTR(): expected 1 or 2, got 1" -- }) @@ -693,7 +693,7 @@ if ("ሴ" ~= "u1234") SELECT SUBSTR('hiሴho', 1,1,1) ]], { -- - 1, "wrong number of arguments to function SUBSTR()" + 1, "Wrong number of arguments is passed to SUBSTR(): expected 1 or 2, got 4" -- }) @@ -1038,7 +1038,7 @@ test:do_catchsql_test( SELECT SUBSTR() ]], { -- - 1, "wrong number of arguments to function SUBSTR()" + 1, "Wrong number of arguments is passed to SUBSTR(): expected 1 or 2, got 0" -- }) @@ -1048,7 +1048,7 @@ test:do_catchsql_test( SELECT SUBSTR(x'1234') ]], { -- - 1, "wrong number of arguments to function SUBSTR()" + 1, "Wrong number of arguments is passed to SUBSTR(): expected 1 or 2, got 1" -- }) @@ -1058,7 +1058,7 @@ test:do_catchsql_test( SELECT SUBSTR(x'1234', 1,1,1) ]], { -- - 1, "wrong number of arguments to function SUBSTR()" + 1, "Wrong number of arguments is passed to SUBSTR(): expected 1 or 2, got 4" -- }) diff --git a/test/sql-tap/limit.test.lua b/test/sql-tap/limit.test.lua index 8445ab18e..870233942 100755 --- a/test/sql-tap/limit.test.lua +++ b/test/sql-tap/limit.test.lua @@ -771,7 +771,7 @@ test:do_catchsql_test( SELECT * FROM t1 LIMIT replace(1) ]], { -- - 1, "wrong number of arguments to function REPLACE()" + 1, "Wrong number of arguments is passed to REPLACE(): expected 3, got 1" -- }) @@ -781,7 +781,7 @@ test:do_catchsql_test( SELECT * FROM t1 LIMIT 5 OFFSET replace(1) ]], { -- - 1, 'wrong number of arguments to function REPLACE()' + 1, 'Wrong number of arguments is passed to REPLACE(): expected 3, got 1' -- }) diff --git a/test/sql-tap/select1.test.lua b/test/sql-tap/select1.test.lua index 924c0ccb1..4bbfbd67b 100755 --- a/test/sql-tap/select1.test.lua +++ b/test/sql-tap/select1.test.lua @@ -244,7 +244,7 @@ test:do_catchsql_test( SELECT count(f1,f2) FROM test1 ]], { -- - 1, "wrong number of arguments to function COUNT()" + 1, "Wrong number of arguments is passed to COUNT(): expected 0 or 1, got 2" -- }) @@ -324,7 +324,7 @@ test:do_catchsql_test( SELECT min(*) FROM test1 ]], { -- - 1, "wrong number of arguments to function MIN()" + 1, "Wrong number of arguments is passed to MIN(): expected 1, got 0" -- }) @@ -389,7 +389,7 @@ test:do_catchsql_test( SELECT MAX(*) FROM test1 ]], { -- - 1, "wrong number of arguments to function MAX()" + 1, "Wrong number of arguments is passed to MAX(): expected 1, got 0" -- }) @@ -469,7 +469,7 @@ test:do_catchsql_test( SELECT SUM(*) FROM test1 ]], { -- - 1, "wrong number of arguments to function SUM()" + 1, "Wrong number of arguments is passed to SUM(): expected 1, got 0" -- }) @@ -489,7 +489,7 @@ test:do_catchsql_test( SELECT sum(f1,f2) FROM test1 ]], { -- - 1, "wrong number of arguments to function SUM()" + 1, "Wrong number of arguments is passed to SUM(): expected 1, got 2" -- }) @@ -691,7 +691,7 @@ test:do_catchsql_test( SELECT f1 FROM test1 WHERE count(f1,f2)!=11 ]], { -- - 1, "wrong number of arguments to function COUNT()" + 1, "misuse of aggregate function COUNT()" -- }) diff --git a/test/sql-tap/where2.test.lua b/test/sql-tap/where2.test.lua index 4116ca913..f267be8e6 100755 --- a/test/sql-tap/where2.test.lua +++ b/test/sql-tap/where2.test.lua @@ -231,7 +231,7 @@ test:do_execsql_test( EXPLAIN SELECT * FROM x1, x2 WHERE x=1 ORDER BY random(); ]], { -- - "/random/" + "/RANDOM/" -- }) @@ -254,7 +254,7 @@ test:do_execsql_test( EXPLAIN SELECT * FROM x1, x2 WHERE x=1 ORDER BY abs(5); ]], { -- - "~/abs/" + "~/ABS/" -- }) diff --git a/test/sql/icu-upper-lower.result b/test/sql/icu-upper-lower.result index 88266c8c5..8ff7528f3 100644 --- a/test/sql/icu-upper-lower.result +++ b/test/sql/icu-upper-lower.result @@ -277,7 +277,7 @@ test_run:cmd("setopt delimiter ''"); box.execute("select upper('1', 2)") --- - null -- wrong number of arguments to function UPPER() +- 'Wrong number of arguments is passed to UPPER(): expected 1, got 2' ... box.execute("select upper(\"1\")") --- @@ -287,5 +287,5 @@ box.execute("select upper(\"1\")") box.execute("select upper()") --- - null -- wrong number of arguments to function UPPER() +- 'Wrong number of arguments is passed to UPPER(): expected 1, got 0' ... -- 2.22.1