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 021FF272D5 for ; Fri, 16 Aug 2019 09:27:00 -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 WlS8JC1ambzo for ; Fri, 16 Aug 2019 09:26:59 -0400 (EDT) Received: from smtp60.i.mail.ru (smtp60.i.mail.ru [217.69.128.40]) (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 B863126DE4 for ; Fri, 16 Aug 2019 09:26:59 -0400 (EDT) From: Kirill Shcherbatov Subject: [tarantool-patches] [PATCH v3 6/9] sql: remove SQL_FUNC_SLOCHNG flag Date: Fri, 16 Aug 2019 16:26:52 +0300 Message-Id: <593a90c31707df8aa3b34292a0d931257a3995e0.1565961887.git.kshcherbatov@tarantool.org> In-Reply-To: References: MIME-Version: 1.0 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, korablev@tarantool.org Cc: Kirill Shcherbatov The SQL_FUNC_SLOCHNG flag was useful for datetime function that are currently not supported. So it could be removed. Needed for #2200, #4113, #2233 --- src/box/sql/sqlInt.h | 15 +-------------- src/box/sql/resolve.c | 4 +--- src/box/sql/vdbemem.c | 6 ++---- 3 files changed, 4 insertions(+), 21 deletions(-) diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h index bc3c639e6..5a3e8f1c1 100644 --- a/src/box/sql/sqlInt.h +++ b/src/box/sql/sqlInt.h @@ -1318,9 +1318,7 @@ struct FuncDestructor { #define SQL_FUNC_UNLIKELY 0x0400 /* Built-in unlikely() function */ #define SQL_FUNC_CONSTANT 0x0800 /* Constant inputs give a constant output */ #define SQL_FUNC_MINMAX 0x1000 /* True for min() and max() aggregates */ -#define SQL_FUNC_SLOCHNG 0x2000 /* "Slow Change". Value constant during a - * single query - might change over time - */ + /** * If function returns string, it may require collation to be * applied on its result. For instance, result of substr() @@ -1359,11 +1357,6 @@ enum trim_side_mask { * VFUNCTION(zName, nArg, iArg, bNC, xFunc) * Like FUNCTION except it omits the sql_FUNC_CONSTANT flag. * - * DFUNCTION(zName, nArg, iArg, bNC, xFunc) - * Like FUNCTION except it omits the sql_FUNC_CONSTANT flag and - * adds the sql_FUNC_SLOCHNG flag. Used for date & time functions, - * but not during a single query. - * * AGGREGATE(zName, nArg, iArg, bNC, xStep, xFinal) * Used to create an aggregate function definition implemented by * the C functions xStep and xFinal. The first four parameters @@ -1387,15 +1380,9 @@ enum trim_side_mask { #define VFUNCTION(zName, nArg, iArg, bNC, xFunc, type) \ {nArg, (bNC*SQL_FUNC_NEEDCOLL), \ SQL_INT_TO_PTR(iArg), 0, xFunc, 0, #zName, {0}, type} -#define DFUNCTION(zName, nArg, iArg, bNC, xFunc, type) \ - {nArg, SQL_FUNC_SLOCHNG|(bNC*SQL_FUNC_NEEDCOLL), \ - SQL_INT_TO_PTR(iArg), 0, xFunc, 0, #zName, {0}, type} #define FUNCTION2(zName, nArg, iArg, bNC, xFunc, extraFlags, type) \ {nArg,SQL_FUNC_CONSTANT|(bNC*SQL_FUNC_NEEDCOLL)|extraFlags,\ SQL_INT_TO_PTR(iArg), 0, xFunc, 0, #zName, {0}, type} -#define STR_FUNCTION(zName, nArg, pArg, bNC, xFunc) \ - {nArg, SQL_FUNC_SLOCHNG|(bNC*SQL_FUNC_NEEDCOLL), \ - pArg, 0, xFunc, 0, #zName, {SQL_AFF_STRING, {0}}} #define LIKEFUNC(zName, nArg, arg, flags, type) \ {nArg, SQL_FUNC_NEEDCOLL|SQL_FUNC_CONSTANT|flags, \ (void *)(SQL_INT_TO_PTR(arg)), 0, likeFunc, 0, #zName, {0}, type} diff --git a/src/box/sql/resolve.c b/src/box/sql/resolve.c index 0b90edd06..207f57ba6 100644 --- a/src/box/sql/resolve.c +++ b/src/box/sql/resolve.c @@ -647,9 +647,7 @@ resolveExprStep(Walker * pWalker, Expr * pExpr) 'u' ? 8388608 : 125829120; } } - if (pDef-> - funcFlags & (SQL_FUNC_CONSTANT | - SQL_FUNC_SLOCHNG)) { + if ((pDef->funcFlags & SQL_FUNC_CONSTANT) != 0) { /* For the purposes of the EP_ConstFunc flag, date and time * functions and other functions that change slowly are considered * constant because they are constant for the duration of one query diff --git a/src/box/sql/vdbemem.c b/src/box/sql/vdbemem.c index b8c31ecec..5516d7fb1 100644 --- a/src/box/sql/vdbemem.c +++ b/src/box/sql/vdbemem.c @@ -1302,11 +1302,9 @@ valueFromFunction(sql * db, /* The database connection */ nVal = pList->nExpr; pFunc = sqlFindFunction(db, p->u.zToken, nVal, 0); assert(pFunc); - if ((pFunc->funcFlags & (SQL_FUNC_CONSTANT | SQL_FUNC_SLOCHNG)) == - 0 || (pFunc->funcFlags & SQL_FUNC_NEEDCOLL) - ) { + if ((pFunc->funcFlags & SQL_FUNC_CONSTANT) == 0 || + (pFunc->funcFlags & SQL_FUNC_NEEDCOLL)) return 0; - } if (pList) { apVal = -- 2.22.1