[tarantool-patches] Re: [PATCH 2/2] sql: rename instr to position & add collation usage
n.pettik
korablev at tarantool.org
Thu Mar 28 15:57:12 MSK 2019
>>> +
>>> +-- 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('à');
>>> + 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èrty');
>>> + 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èrtÿ');
>>> + 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’t we already have such tests? From 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 ‘implicitly set’. Still can’t find such tests.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20190328/a5902e5f/attachment.html>
More information about the Tarantool-patches
mailing list