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 6A9922DBA8 for ; Thu, 25 Oct 2018 07:00:20 -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 aFoYteZSGQBy for ; Thu, 25 Oct 2018 07:00:20 -0400 (EDT) Received: from smtp57.i.mail.ru (smtp57.i.mail.ru [217.69.128.37]) (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 9FAED2DB8F for ; Thu, 25 Oct 2018 07:00:19 -0400 (EDT) From: Nikita Pettik Subject: [tarantool-patches] [PATCH 1/3] sql: do not add explicit clause Date: Thu, 25 Oct 2018 14:00:07 +0300 Message-Id: <9065ac43f61e7e211d4b248b68e17a64e8caa4f4.1540460716.git.korablev@tarantool.org> In-Reply-To: References: 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: tarantool-patches@freelists.org Cc: v.shpilevoy@tarantool.org, Nikita Pettik We don't need to add explicit COLLATE "BINARY" clause since binary collation is anyway default. On the other hand, it may confuse due to ambiugty when comparing two terms. Needed for #3185 --- src/box/sql/fkey.c | 2 -- src/box/sql/select.c | 4 ---- src/box/sql/whereexpr.c | 25 ++++++++++++------------- 3 files changed, 12 insertions(+), 19 deletions(-) diff --git a/src/box/sql/fkey.c b/src/box/sql/fkey.c index b2d2a19e7..ee1de8e18 100644 --- a/src/box/sql/fkey.c +++ b/src/box/sql/fkey.c @@ -313,8 +313,6 @@ exprTableRegister(Parse * pParse, /* Parsing and code generating context */ pExpr->iTable = regBase + iCol + 1; char affinity = pTab->def->fields[iCol].affinity; pExpr->affinity = affinity; - pExpr = sqlite3ExprAddCollateString(pParse, pExpr, - "binary"); } else { pExpr->iTable = regBase; pExpr->affinity = AFFINITY_INTEGER; diff --git a/src/box/sql/select.c b/src/box/sql/select.c index 02c0a5d26..1ec92aac7 100644 --- a/src/box/sql/select.c +++ b/src/box/sql/select.c @@ -2311,10 +2311,6 @@ sql_multiselect_orderby_to_key_info(struct Parse *parse, struct Select *s, order_by->a[i].pExpr = sqlite3ExprAddCollateString(parse, term, name); - } else { - order_by->a[i].pExpr = - sqlite3ExprAddCollateString(parse, term, - "BINARY"); } } part->coll_id = id; diff --git a/src/box/sql/whereexpr.c b/src/box/sql/whereexpr.c index 612868695..9fa6ce15d 100644 --- a/src/box/sql/whereexpr.c +++ b/src/box/sql/whereexpr.c @@ -1133,7 +1133,6 @@ exprAnalyze(SrcList * pSrc, /* the FROM clause */ Expr *pNewExpr2; int idxNew1; int idxNew2; - const char *zCollSeqName; /* Name of collating sequence */ const u16 wtFlags = TERM_LIKEOPT | TERM_VIRTUAL | TERM_DYNAMIC; pLeft = pExpr->x.pList->a[1].pExpr; @@ -1171,24 +1170,24 @@ exprAnalyze(SrcList * pSrc, /* the FROM clause */ } *pC = c + 1; } - /* Support only for unicode_ci indexes by now */ - zCollSeqName = noCase ? "unicode_ci" : "BINARY"; pNewExpr1 = sqlite3ExprDup(db, pLeft, 0); - pNewExpr1 = sqlite3PExpr(pParse, TK_GE, - sqlite3ExprAddCollateString(pParse, - pNewExpr1, - zCollSeqName), - pStr1); + if (noCase) { + pNewExpr1 = + sqlite3ExprAddCollateString(pParse, pNewExpr1, + "unicode_ci"); + } + pNewExpr1 = sqlite3PExpr(pParse, TK_GE, pNewExpr1, pStr1); transferJoinMarkings(pNewExpr1, pExpr); idxNew1 = whereClauseInsert(pWC, pNewExpr1, wtFlags); testcase(idxNew1 == 0); exprAnalyze(pSrc, pWC, idxNew1); pNewExpr2 = sqlite3ExprDup(db, pLeft, 0); - pNewExpr2 = sqlite3PExpr(pParse, TK_LT, - sqlite3ExprAddCollateString(pParse, - pNewExpr2, - zCollSeqName), - pStr2); + if (noCase) { + pNewExpr2 = + sqlite3ExprAddCollateString(pParse, pNewExpr2, + "unicode_ci"); + } + pNewExpr2 = sqlite3PExpr(pParse, TK_LT, pNewExpr2, pStr2); transferJoinMarkings(pNewExpr2, pExpr); idxNew2 = whereClauseInsert(pWC, pNewExpr2, wtFlags); testcase(idxNew2 == 0); -- 2.15.1