/ Check-in [9a5a489d]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:New test case for the ORDER BY LIMIT optimization.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9a5a489d0d344274d0fc9fb9303503a454f42844
User & Date: drh 2016-09-23 18:13:01
Context
2016-09-23
20:59
Use sqlite3ExprAlloc() instead of sqlite3PExpr() for leaf nodes in the expression tree, where appropriate. This is both smaller and faster. check-in: afac0709 user: drh tags: trunk
18:13
New test case for the ORDER BY LIMIT optimization. check-in: 9a5a489d user: drh tags: trunk
2016-09-22
21:37
Fix a potential null-pointer dereference and crash in the case where one thread is calling sqlite3_column_text() and another thread is calling sqlite3_step() on the same prepared statement at the same instant. check-in: ee1382a3 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/limit2.test.

   105    105     INSERT INTO t300 VALUES(0,1,99),(0,1,0),(0,0,0);
   106    106     SELECT *,'.' FROM t300 WHERE a=0 AND (c=0 OR c=99) ORDER BY c DESC;
   107    107   } {0 1 99 . 0 0 0 . 0 1 0 .}
   108    108   do_execsql_test limit2-310 {
   109    109     SELECT *,'.' FROM t300 WHERE a=0 AND (c=0 OR c=99) ORDER BY c DESC LIMIT 1;
   110    110   } {0 1 99 .}
   111    111   
   112         -
   113         -
          112  +# Make sure the SELECT loop is ordered correctly for the direction of
          113  +# the ORDER BY
          114  +#
          115  +do_execsql_test limit2-400 {
          116  +  CREATE TABLE t400(a,b);
          117  +  CREATE INDEX t400_ab ON t400(a,b);
          118  +  INSERT INTO t400(a,b) VALUES(1,90),(1,40),(2,80),(2,30),(3,70),(3,20);
          119  +  SELECT *,'x' FROM t400 WHERE a IN (1,2,3) ORDER BY b DESC LIMIT 3;
          120  +  SELECT *,'y' FROM t400 WHERE a IN (1,2,3) ORDER BY +b DESC LIMIT 3;
          121  +} {1 90 x 2 80 x 3 70 x 1 90 y 2 80 y 3 70 y}
   114    122   
   115    123   finish_test