<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hello!<div class=""><br class=""></div><div class="">Thank you for comments.<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Nov 9, 2018, at 15:18, Alexander Turenko <<a href="mailto:alexander.turenko@tarantool.org" class="">alexander.turenko@tarantool.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Hi!<br class=""><br class="">See comments below.<br class=""><br class="">WBR, Alexander Turenko.<br class=""><br class="">On Thu, Nov 08, 2018 at 06:09:23PM +0300, Nikita Tatunov wrote:<br class=""><blockquote type="cite" class="">Hello! thank you for the review.<br class=""><br class="">Issues:<br class=""><a href="https://github.com/tarantool/tarantool/issues/3251" class="">https://github.com/tarantool/tarantool/issues/3251</a> <<a href="https://github.com/tarantool/tarantool/issues/3251" class="">https://github.com/tarantool/tarantool/issues/3251</a>><br class=""><a href="https://github.com/tarantool/tarantool/issues/3334" class="">https://github.com/tarantool/tarantool/issues/3334</a> <<a href="https://github.com/tarantool/tarantool/issues/3334" class="">https://github.com/tarantool/tarantool/issues/3334</a>><br class=""><br class="">Branch:<br class=""><a href="https://github.com/tarantool/tarantool/tree/N_Tatunov/gh-3251-where-like-hangs" class="">https://github.com/tarantool/tarantool/tree/N_Tatunov/gh-3251-where-like-hangs</a> <<a href="https://github.com/tarantool/tarantool/tree/N_Tatunov/gh-3251-where-like-hangs" class="">https://github.com/tarantool/tarantool/tree/N_Tatunov/gh-3251-where-like-hangs</a>><br class=""><br class=""></blockquote><br class="">It seems you forgot to push the new changes.<br class=""></div></div></blockquote><div><br class=""></div><div>Ermm, did I? I have just opened the branch and it contains a commit</div><div>which was pushed at 8th of November (and as I see it’s exactly the commit</div><div>from the diff)</div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class=""><blockquote type="cite" class="">@@ -913,7 +899,7 @@ likeFunc(sqlite3_context *context, int argc, sqlite3_value **argv)<br class=""> <span class="Apple-tab-span" style="white-space:pre">       </span>sqlite3_like_count++;<br class=""> #endif<br class=""> <span class="Apple-tab-span" style="white-space:pre">     </span>int res;<br class="">-<span class="Apple-tab-span" style="white-space:pre">      </span>res = sql_utf8_pattern_compare(zB, zA, *is_like_ci, escape);<br class="">+<span class="Apple-tab-span" style="white-space:pre">  </span>res = sql_utf8_pattern_compare(zB, zA, is_like_ci, escape);<br class=""> <span class="Apple-tab-span" style="white-space:pre">   </span>if (res == SQL_INVALID_PATTERN) {<br class=""> <span class="Apple-tab-span" style="white-space:pre">     </span><span class="Apple-tab-span" style="white-space:pre">    </span>const char *const err_msg =<br class=""> <span class="Apple-tab-span" style="white-space:pre">   </span><span class="Apple-tab-span" style="white-space:pre">    </span><span class="Apple-tab-span" style="white-space:pre">    </span>"LIKE pattern can only contain UTF-8 characters";<br class="">@@ -1698,24 +1684,20 @@ setLikeOptFlag(sqlite3 * db, const char *zName, u8 flagVal)<br class="">  * @retval none.<br class="">  */<br class=""> void<br class="">-sqlite3RegisterLikeFunctions(sqlite3 *db, int is_case_sensitive)<br class="">+sqlite3RegisterLikeFunctions(sqlite3 *db, int *is_case_insensitive)<br class=""> {<br class=""> <span class="Apple-tab-span" style="white-space:pre">  </span>/*<br class=""> <span class="Apple-tab-span" style="white-space:pre">    </span> * FIXME: after introducing type <BOOLEAN> LIKE must<br class=""> <span class="Apple-tab-span" style="white-space:pre">    </span> * return that type: TRUE if the string matches the<br class=""> <span class="Apple-tab-span" style="white-space:pre">   </span> * supplied pattern and FALSE otherwise.<br class=""> <span class="Apple-tab-span" style="white-space:pre">      </span> */<br class="">-<span class="Apple-tab-span" style="white-space:pre">   </span>int *is_like_ci;<br class="">-<span class="Apple-tab-span" style="white-space:pre">      </span>if (is_case_sensitive)<br class="">-<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">    </span>is_like_ci = (void *)&case_sensitive_like;<br class="">-<span class="Apple-tab-span" style="white-space:pre">        </span>else<br class="">-<span class="Apple-tab-span" style="white-space:pre">  </span><span class="Apple-tab-span" style="white-space:pre">    </span>is_like_ci = (void *)&case_insensitive_like;<br class="">-<span class="Apple-tab-span" style="white-space:pre">      </span>sqlite3CreateFunc(db, "LIKE", AFFINITY_INTEGER, 2, 0, is_like_ci,<br class="">-<span class="Apple-tab-span" style="white-space:pre">   </span><span class="Apple-tab-span" style="white-space:pre">    </span><span class="Apple-tab-span" style="white-space:pre">    </span>  likeFunc, 0, 0, 0);<br class="">-<span class="Apple-tab-span" style="white-space:pre">    </span>sqlite3CreateFunc(db, "LIKE", AFFINITY_INTEGER, 3, 0, is_like_ci,<br class="">-<span class="Apple-tab-span" style="white-space:pre">   </span><span class="Apple-tab-span" style="white-space:pre">    </span><span class="Apple-tab-span" style="white-space:pre">    </span>  likeFunc, 0, 0, 0);<br class="">+<span class="Apple-tab-span" style="white-space:pre">    </span>int is_like_ci = SQLITE_PTR_TO_INT(is_case_insensitive);<br class="">+<span class="Apple-tab-span" style="white-space:pre">      </span>sqlite3CreateFunc(db, "LIKE", AFFINITY_INTEGER, 2, 0,<br class="">+<span class="Apple-tab-span" style="white-space:pre">       </span><span class="Apple-tab-span" style="white-space:pre">    </span><span class="Apple-tab-span" style="white-space:pre">    </span>  is_case_insensitive, likeFunc, 0, 0, 0);<br class="">+<span class="Apple-tab-span" style="white-space:pre">       </span>sqlite3CreateFunc(db, "LIKE", AFFINITY_INTEGER, 3, 0,<br class="">+<span class="Apple-tab-span" style="white-space:pre">       </span><span class="Apple-tab-span" style="white-space:pre">    </span><span class="Apple-tab-span" style="white-space:pre">    </span>  is_case_insensitive, likeFunc, 0, 0, 0);<br class=""> <span class="Apple-tab-span" style="white-space:pre">       </span>setLikeOptFlag(db, "LIKE",<br class="">-<span class="Apple-tab-span" style="white-space:pre">  </span><span class="Apple-tab-span" style="white-space:pre">    </span>       is_case_sensitive ? (SQLITE_FUNC_LIKE |<br class="">+<span class="Apple-tab-span" style="white-space:pre">  </span><span class="Apple-tab-span" style="white-space:pre">    </span>       !(is_like_ci) ? (SQLITE_FUNC_LIKE |<br class=""> <span class="Apple-tab-span" style="white-space:pre">      </span><span class="Apple-tab-span" style="white-space:pre">    </span>       SQLITE_FUNC_CASE) : SQLITE_FUNC_LIKE);<br class=""> }<br class=""></blockquote><br class="">I think sqlite3RegisterLikeFunctions should accept int as the second<br class="">parameter.<br class=""></div></div></blockquote><div><br class=""></div><div>Sure, fixed it.</div><br class=""><blockquote type="cite" class=""><div class=""><div class="">BTW, it seems that we add SQLITE_FUNC_CASE into flags, so maybe we can<br class="">read it in likeFunc and don't pass additional parameter at all? It is<br class="">just raw idea, I don't know the mechanics of sql functions much.<br class=""></div></div></blockquote><div><br class=""></div><div>I’m not sure it’s a good idea, at least not in terms of this patch.</div><div>Call to likeFunc comes right from OP_FUNCTION which is used for sql</div><div>functions (of course it’s not only LIKE). Thus the list of parameters is</div><div>pretty much defined there.</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre">  </span>(*pCtx->pFunc->xSFunc)(pCtx, pCtx->argc, pCtx->argv);/* IMP: R-24505-23230 */</div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class=""><blockquote type="cite" class="">diff --git a/test/sql-tap/collation.test.lua b/test/sql-tap/collation.test.lua<br class="">index eb4f43a90..dbbe1c0fe 100755<br class="">--- a/test/sql-tap/collation.test.lua<br class="">+++ b/test/sql-tap/collation.test.lua<br class="">@@ -219,7 +219,7 @@ local like_testcases =<br class="">         {0, {"Aab", "aaa"}} },<br class="">     {"2.1.2",<br class="">         "EXPLAIN QUERY PLAN SELECT * FROM tx1 WHERE s1 LIKE 'A%';",<br class="">-        {0, {0, 0, 0, "/USING COVERING INDEX I1/"}} },<br class="">+        {0, {0, 0, 0, "SEARCH TABLE TX1 USING COVERING INDEX I1 (S1>? AND S1<?)"}}},<br class=""></blockquote><br class="">What is this hunk about?<br class=""></div></div></blockquote><br class=""></div><div>I found that this changed message occurs even on fresh 2.1.</div><div>I was using this and few other test cases to test my patch so it was</div><div>kind of concerned with the patch and i decided to fix it at the same time.</div><div>(I don’t really think it does worth opening an issue).</div><div>I assume this issue was caused by<span style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);" class=""> </span><span style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);" class="">commit</span> <span style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);" class="">6b8acd8fde and just</span></div><div><span style="background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">wasn’t fixed.</span></font></span></div><div>I guess I should’ve wrote about it in the previous letter.</div><div><br class=""></div><div><br class=""></div><div>diff with the previous version:</div><div><br class=""></div><div><div>diff --git a/src/box/sql/func.c b/src/box/sql/func.c</div><div>index 5feab52f6..ed7926b18 100644</div><div>--- a/src/box/sql/func.c</div><div>+++ b/src/box/sql/func.c</div><div>@@ -1684,20 +1684,20 @@ setLikeOptFlag(sqlite3 * db, const char *zName, u8 flagVal)</div><div>  * @retval none.</div><div>  */</div><div> void</div><div>-sqlite3RegisterLikeFunctions(sqlite3 *db, int *is_case_insensitive)</div><div>+sqlite3RegisterLikeFunctions(sqlite3 *db, int is_case_insensitive)</div><div> {</div><div> <span class="Apple-tab-span" style="white-space:pre">      </span>/*</div><div> <span class="Apple-tab-span" style="white-space:pre">     </span> * FIXME: after introducing type <BOOLEAN> LIKE must</div><div> <span class="Apple-tab-span" style="white-space:pre">     </span> * return that type: TRUE if the string matches the</div><div> <span class="Apple-tab-span" style="white-space:pre">    </span> * supplied pattern and FALSE otherwise.</div><div> <span class="Apple-tab-span" style="white-space:pre">       </span> */</div><div>-<span class="Apple-tab-span" style="white-space:pre"> </span>int is_like_ci = SQLITE_PTR_TO_INT(is_case_insensitive);</div><div>+<span class="Apple-tab-span" style="white-space:pre">    </span>int *is_like_ci = SQLITE_INT_TO_PTR(is_case_insensitive);</div><div> <span class="Apple-tab-span" style="white-space:pre">      </span>sqlite3CreateFunc(db, "LIKE", AFFINITY_INTEGER, 2, 0,</div><div>-<span class="Apple-tab-span" style="white-space:pre">                     </span>  is_case_insensitive, likeFunc, 0, 0, 0);</div><div>+<span class="Apple-tab-span" style="white-space:pre">                     </span>  is_like_ci, likeFunc, 0, 0, 0);</div><div> <span class="Apple-tab-span" style="white-space:pre"> </span>sqlite3CreateFunc(db, "LIKE", AFFINITY_INTEGER, 3, 0,</div><div>-<span class="Apple-tab-span" style="white-space:pre">                     </span>  is_case_insensitive, likeFunc, 0, 0, 0);</div><div>+<span class="Apple-tab-span" style="white-space:pre">                     </span>  is_like_ci, likeFunc, 0, 0, 0);</div><div> <span class="Apple-tab-span" style="white-space:pre"> </span>setLikeOptFlag(db, "LIKE",</div><div>-<span class="Apple-tab-span" style="white-space:pre">                </span>       !(is_like_ci) ? (SQLITE_FUNC_LIKE |</div><div>+<span class="Apple-tab-span" style="white-space:pre">           </span>       !(is_case_insensitive) ? (SQLITE_FUNC_LIKE |</div><div> <span class="Apple-tab-span" style="white-space:pre">             </span>       SQLITE_FUNC_CASE) : SQLITE_FUNC_LIKE);</div><div> }</div><div> </div><div>diff --git a/src/box/sql/pragma.c b/src/box/sql/pragma.c</div><div>index 546b18ae2..8939aa702 100644</div><div>--- a/src/box/sql/pragma.c</div><div>+++ b/src/box/sql/pragma.c</div><div>@@ -586,10 +586,9 @@ sqlite3Pragma(Parse * pParse, Token * pId,<span class="Apple-tab-span" style="white-space:pre">      </span>/* First part of [schema.]id field */</div><div> <span class="Apple-tab-span" style="white-space:pre">          </span> */</div><div> <span class="Apple-tab-span" style="white-space:pre">    </span>case PragTyp_CASE_SENSITIVE_LIKE:{</div><div> <span class="Apple-tab-span" style="white-space:pre">                     </span>if (zRight) {</div><div>-<span class="Apple-tab-span" style="white-space:pre">                               </span>int *is_like_ci =</div><div>-<span class="Apple-tab-span" style="white-space:pre">                                   </span>SQLITE_INT_TO_PTR(!(sqlite3GetBoolean(zRight, 0)));</div><div>-<span class="Apple-tab-span" style="white-space:pre">                         </span>sqlite3RegisterLikeFunctions(db,</div><div>-<span class="Apple-tab-span" style="white-space:pre">                                                    </span>     is_like_ci);</div><div>+<span class="Apple-tab-span" style="white-space:pre">                         </span>int is_like_ci =</div><div>+<span class="Apple-tab-span" style="white-space:pre">                                    </span>!(sqlite3GetBoolean(zRight, 0));</div><div>+<span class="Apple-tab-span" style="white-space:pre">                            </span>sqlite3RegisterLikeFunctions(db, is_like_ci);</div><div> <span class="Apple-tab-span" style="white-space:pre">                  </span>}</div><div> <span class="Apple-tab-span" style="white-space:pre">                      </span>break;</div><div> <span class="Apple-tab-span" style="white-space:pre">         </span>}</div><div>diff --git a/src/box/sql/sqliteInt.h b/src/box/sql/sqliteInt.h</div><div>index dd819622b..07e83e444 100644</div><div>--- a/src/box/sql/sqliteInt.h</div><div>+++ b/src/box/sql/sqliteInt.h</div><div>@@ -4551,7 +4551,7 @@ sql_key_info_unref(struct sql_key_info *key_info);</div><div> struct key_def *</div><div> sql_key_info_to_key_def(struct sql_key_info *key_info);</div><div> </div><div>-void sqlite3RegisterLikeFunctions(sqlite3 *, int *);</div><div>+void sqlite3RegisterLikeFunctions(sqlite3 *, int);</div><div> int sql_is_like_func(sqlite3 *, Expr *, int *);</div><div> int sqlite3CreateFunc(sqlite3 *, const char *, enum affinity_type,</div><div> <span class="Apple-tab-span" style="white-space:pre">           </span>      int, int, void *,</div><div class=""><br class=""></div></div><br class=""></div></body></html>