From: "n.pettik" <korablev@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Roman Khabibov <roman.habibov@tarantool.org>,
Kirill Yukhin <kyukhin@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH 2/2] sql: make LIKE predicate dependent on collation
Date: Thu, 1 Aug 2019 13:27:07 +0300 [thread overview]
Message-ID: <1731E5BF-8ADB-4D22-AF6F-52211E7BA33D@tarantool.org> (raw)
In-Reply-To: <9DFC7444-7C8D-4DB0-B059-948122587CE4@tarantool.org>
>>> * @param pisComplete True if the only wildcard is '%' in the
>>> * last character.
>>> * @retval True if the given expr is a LIKE operator & is
>>> @@ -276,9 +274,20 @@ like_optimization_is_valid(Parse *pParse, Expr *pExpr, Expr **ppPrefix,
>>> */
>>> return 0;
>>> }
>>> +
>>> + /* Only for "binary" and "unicode_ci" collations. */
>>
>> Why only two collations? Why not “unicode” for instance?
>> What if collation is a part of expression, not field:
>> … a COLLATE “unicode” LIKE … ?
> For instance, we consider the following query '... WHERE x LIKE "A%" COLLATE "unicode"' (strength - tertiary). The optimization will be: "A" <= x < "B". Let's take x == "aaa". Comparison of "aaa" and "A" gives us '1'. Comparison of "aaa" and "B" gives us '-1'. In other words, "A" <= "aaa" < "B", but it is a bad result, because "aaa" is not LIKE "A%" COLLATE "unicode”.
Ok, but occasionally test suite didn’t include test case
checking this situation. I’ve added it alongside with
clarifying comments and minor fixes and put on
the branch: np/sql-like-collation
https://github.com/tarantool/tarantool/tree/np/sql-like-collation
With these fixes LGTM.
next prev parent reply other threads:[~2019-08-01 10:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-13 22:51 [tarantool-patches] [PATCH 0/2] Make " Roman Khabibov
2019-07-13 22:51 ` [tarantool-patches] [PATCH 1/2] sql: remove "PRAGMA case_sensitive_like" Roman Khabibov
2019-07-17 16:18 ` [tarantool-patches] " n.pettik
2019-07-24 21:02 ` Roman Khabibov
2019-07-13 22:51 ` [tarantool-patches] [PATCH 2/2] sql: make LIKE predicate dependent on collation Roman Khabibov
2019-07-17 16:19 ` [tarantool-patches] " n.pettik
2019-07-24 21:02 ` Roman Khabibov
2019-08-01 10:27 ` n.pettik [this message]
2019-08-01 12:26 ` [tarantool-patches] Re: [PATCH 0/2] Make " Kirill Yukhin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1731E5BF-8ADB-4D22-AF6F-52211E7BA33D@tarantool.org \
--to=korablev@tarantool.org \
--cc=kyukhin@tarantool.org \
--cc=roman.habibov@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='[tarantool-patches] Re: [PATCH 2/2] sql: make LIKE predicate dependent on collation' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox