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 F351C32725 for ; Fri, 28 Jun 2019 09:13:39 -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 zFDJoJ9zXbBu for ; Fri, 28 Jun 2019 09:13:39 -0400 (EDT) Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (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 B31FD32724 for ; Fri, 28 Jun 2019 09:13:39 -0400 (EDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Subject: [tarantool-patches] Re: [PATCH 1/2 v2] test: check that collations isn't ignored in SELECTs From: Roman Khabibov In-Reply-To: Date: Fri, 28 Jun 2019 16:13:37 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <6E3410C5-7C18-462A-8A0E-117A7D286545@tarantool.org> References: <49f3a1279811efc66c580c6039cf1b890ff37889.1561372731.git.roman.habibov@tarantool.org> 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: "n. pettik" Forgot. commit 40690ab014e80d954c0139506ed41b0aa18b95d5 Author: Roman Khabibov Date: Mon May 6 14:45:51 2019 +0300 test: check that collations isn't ignored in SELECTs =20 Add test to check that a new collation isn't ignored regardless of a name of a previous one in the following patterns of queries: =20 SELECT s COLLATE "unicode_ci" FROM a ORDER BY s COLLATE "unicode_ci" =20 Also note: It is disallowed to compare strings with different collations: ISO/IEC JTC 1/SC 32, Part 2: Foundation, page 531 diff --git a/src/box/sql/resolve.c b/src/box/sql/resolve.c index fdf3703da..348b3ea9a 100644 --- a/src/box/sql/resolve.c +++ b/src/box/sql/resolve.c @@ -109,6 +109,13 @@ resolveAlias(Parse * pParse, /* Parsing = context */ return; if (zType[0] !=3D 'G') incrAggFunctionDepth(pDup, nSubquery); + /* + * If there was typed more than one explicit collations in + * query, it will be a sequence of left nodes with the + * collations in a tree. There is nothing special about + * keeping the sequence. Only one collation could be + * stored, but the present solution is simpler. + */ if (pExpr->op =3D=3D TK_COLLATE) { pDup =3D sqlExprAddCollateString(pParse, pDup, = pExpr->u.zToken); diff --git a/test/sql-tap/collation.test.lua = b/test/sql-tap/collation.test.lua index 79547361c..f36540fc2 100755 --- a/test/sql-tap/collation.test.lua +++ b/test/sql-tap/collation.test.lua @@ -1,6 +1,6 @@ #!/usr/bin/env tarantool test =3D require("sqltester") -test:plan(174) +test:plan(177) =20 local prefix =3D "collation-" =20 @@ -529,4 +529,21 @@ test:do_catchsql_test( 'CREATE TABLE test3 (a int, b int, c int, PRIMARY KEY (a, a = COLLATE foo, b, c))', {1, "Collation 'FOO' does not exist"}) =20 +-- gh-3805 Check that collation is not ignored. + +test:do_execsql_test( + "collation-2.6.0", + [[ CREATE TABLE a (id INT PRIMARY KEY, s TEXT) ]], + {}) + +test:do_execsql_test( + "collation-2.6.1", + [[ INSERT INTO a VALUES (1, 'B'), (2, 'b') ]], + {}) + +test:do_execsql_test( + "collation-2.6.2", + [[ SELECT s COLLATE "unicode_ci" FROM a ORDER BY s COLLATE = "unicode" ]], + {"b","B"}) + test:finish_test()