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 BE8E12077C for ; Thu, 28 Mar 2019 08:57:15 -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 x6z2jb4FR9IT for ; Thu, 28 Mar 2019 08:57:15 -0400 (EDT) Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (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 48AD71F9B2 for ; Thu, 28 Mar 2019 08:57:15 -0400 (EDT) From: "n.pettik" Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_77E18C9D-F652-4E19-B05C-A8D68298FC8E" Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Subject: [tarantool-patches] Re: [PATCH 2/2] sql: rename instr to position & add collation usage Date: Thu, 28 Mar 2019 15:57:12 +0300 In-Reply-To: References: <2f6396ca10b94874467361e482555b225d5256de.1553078164.git.ivan.koptelov@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: Ivan Koptelov --Apple-Mail=_77E18C9D-F652-4E19-B05C-A8D68298FC8E Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 >>> + >>> +-- Collation is set in space format and also in position() - >>> +-- for both arguments. Arguments have different explicit >>> +-- collations thus an error is expected. >>> + >>> +test:do_catchsql_test( >>> + "position-1.75", >>> + [[ >>> + CREATE TABLE test1 (s1 VARCHAR(5) PRIMARY KEY COLLATE = "unicode_ci"); >>> + INSERT INTO test1 VALUES('=C3=A0'); >>> + SELECT POSITION('a' COLLATE "unicode_ci", s1 COLLATE = "unicode") FROM test1; >>> + ]], { >>> + 1, "Illegal mix of collations" >>> + } >>> +) >>> + >>> +test:do_catchsql_test( >>> + "position-1.76", >>> + [[ >>> + DROP TABLE test1; >>> + CREATE TABLE test1 (s1 VARCHAR(5) PRIMARY KEY COLLATE = "unicode_ci"); >>> + INSERT INTO test1 VALUES('qw=C3=A8rty'); >>> + SELECT POSITION('er' COLLATE "unicode_ci", s1 COLLATE = "unicode") FROM test1; >>> + DROP TABLE test1; >>> + ]], { >>> + 1, "Illegal mix of collations" >>> + } >>> +) >>> + >>> +test:do_catchsql_test( >>> + "position-1.77", >>> + [[ >>> + DROP TABLE test1; >>> + CREATE TABLE test1 (s1 VARCHAR(5) PRIMARY KEY COLLATE = "unicode_ci"); >>> + INSERT INTO test1 VALUES('qw=C3=A8rt=C3=BF'); >>> + SELECT POSITION('Y' COLLATE "unicode_ci", s1 COLLATE = "unicode") FROM test1; >>> + ]], { >>> + 1, "Illegal mix of collations" >>> + } >>> +) >>=20 >> Add test cases on: explicitly set incompatible collations, >> explicitly set compatible collations. >>=20 >>=20 >=20 > Don=E2=80=99t we already have such tests? =46rom the end of = position.test.lua: >=20 > -- Collation is set in space format and also in position() - > -- for both arguments. Arguments have the same collations. Oh, I meant =E2=80=98implicitly set=E2=80=99. Still can=E2=80=99t find = such tests. --Apple-Mail=_77E18C9D-F652-4E19-B05C-A8D68298FC8E Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

+
+-- = Collation is set in space format and also in position() -
+-- for both arguments. Arguments have different explicit
+-- collations thus an error is expected.
+
+test:do_catchsql_test(
+ =    "position-1.75",
+ =    [[
+ =        CREATE TABLE test1 (s1 = VARCHAR(5) PRIMARY KEY COLLATE "unicode_ci");
+ =        INSERT INTO test1 = VALUES('=C3=A0');
+ =        SELECT POSITION('a' COLLATE = "unicode_ci", s1 COLLATE "unicode") FROM test1;
+ =    ]], {
+ =        1, "Illegal mix of = collations"
+    }
+)
+
+test:do_catchsql_test(
+ =    "position-1.76",
+ =    [[
+ =        DROP TABLE test1;
+        CREATE TABLE = test1 (s1 VARCHAR(5) PRIMARY KEY COLLATE "unicode_ci");
+ =        INSERT INTO test1 = VALUES('qw=C3=A8rty');
+ =        SELECT POSITION('er' COLLATE = "unicode_ci", s1 COLLATE "unicode") FROM test1;
+ =        DROP TABLE test1;
+    ]], {
+ =        1, "Illegal mix of = collations"
+    }
+)
+
+test:do_catchsql_test(
+ =    "position-1.77",
+ =    [[
+ =        DROP TABLE test1;
+        CREATE TABLE = test1 (s1 VARCHAR(5) PRIMARY KEY COLLATE "unicode_ci");
+ =        INSERT INTO test1 = VALUES('qw=C3=A8rt=C3=BF');
+ =        SELECT POSITION('Y' COLLATE = "unicode_ci", s1 COLLATE "unicode") FROM test1;
+ =    ]], {
+ =        1, "Illegal mix of = collations"
+    }
+)

Add test cases on: explicitly set = incompatible collations,
explicitly set compatible = collations.



Don=E2=80=99t we already have = such tests? =46rom the end of position.test.lua:

-- Collation is set in space = format and also in position() -
-- for both arguments. Arguments have the same = collations.

Oh, I meant =E2=80=98implicitly set=E2=80=99. = Still can=E2=80=99t find such tests.

= --Apple-Mail=_77E18C9D-F652-4E19-B05C-A8D68298FC8E--