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 45FF12EA73 for ; Wed, 8 May 2019 07:29:21 -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 lgikY_vvFHyj for ; Wed, 8 May 2019 07:29:21 -0400 (EDT) Received: from smtp16.mail.ru (smtp16.mail.ru [94.100.176.153]) (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 D51112EA72 for ; Wed, 8 May 2019 07:29:20 -0400 (EDT) From: Roman Khabibov Subject: [tarantool-patches] [PATCH 1/2] sql: fix collation node duplication in AST Date: Wed, 8 May 2019 14:29:15 +0300 Message-Id: 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 Cc: v.shpilevoy@tarantool.org Before this patch, if SELECT was used with compound query, COLLATION clauses and ORDER BY clause, C function resolveAlias built extra node with collation name into OrderBy's AST. E.g., for query: SELECT a COLLATE "unicode_ci" FROM t2 EXCEPT SELECT a FROM t3 ORDER BY 1 was appeared something like: "unicode_ci" / \ extra node -> "unicode_ci" NULL / \ "A" NULL / \ NULL NULL Needed for #3804 --- src/box/sql/resolve.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/box/sql/resolve.c b/src/box/sql/resolve.c index 504096e6d..c2c597dc0 100644 --- a/src/box/sql/resolve.c +++ b/src/box/sql/resolve.c @@ -109,7 +109,7 @@ resolveAlias(Parse * pParse, /* Parsing context */ return; if (zType[0] != 'G') incrAggFunctionDepth(pDup, nSubquery); - if (pExpr->op == TK_COLLATE) { + if (pExpr->op == TK_COLLATE && pDup->op != TK_COLLATE) { pDup = sqlExprAddCollateString(pParse, pDup, pExpr->u.zToken); } -- 2.20.1 (Apple Git-117)