/ Check-in [0e9f534f]
Login

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

Overview
Comment:Make sure affinity is applied correctly on lower-bound range constraints in the min() optimization. Fix for ticket [a0bac8b3c3d1bb].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | apple-osx
Files: files | file ages | folders
SHA1: 0e9f534fef72ca142a4296ab5285c82aada38ba7
User & Date: drh 2016-07-26 04:23:55
Context
2016-07-26
04:54
Merge the cache_spill VACUUM fix from trunk. check-in: cc6bfdf8 user: drh tags: apple-osx
04:31
Make sure affinity is applied correctly on lower-bound range constraints in the min() optimization. Fix for ticket [a0bac8b3c3d1bb]. check-in: b819bace user: drh tags: trunk
04:23
Make sure affinity is applied correctly on lower-bound range constraints in the min() optimization. Fix for ticket [a0bac8b3c3d1bb]. check-in: 0e9f534f user: drh tags: apple-osx
2016-07-25
22:46
Merge the VACCUM cache_size adjustment from trunk. check-in: cdb7efd0 user: drh tags: apple-osx
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/wherecode.c.

  1315   1315           }
  1316   1316           if( sqlite3ExprNeedsNoAffinityChange(pRight, zStartAff[nEq]) ){
  1317   1317             zStartAff[nEq] = SQLITE_AFF_BLOB;
  1318   1318           }
  1319   1319         }  
  1320   1320         nConstraint++;
  1321   1321         testcase( pRangeStart->wtFlags & TERM_VIRTUAL );
         1322  +      bSeekPastNull = 0;
  1322   1323       }else if( bSeekPastNull ){
  1323   1324         sqlite3VdbeAddOp2(v, OP_Null, 0, regBase+nEq);
  1324   1325         nConstraint++;
  1325   1326         startEq = 0;
  1326   1327         start_constraints = 1;
  1327   1328       }
  1328   1329       codeApplyAffinity(pParse, regBase, nConstraint - bSeekPastNull, zStartAff);

Changes to test/minmax.test.

   623    623   } {5}
   624    624   
   625    625   do_test_13_noopt 13.7 {
   626    626     SELECT min(b), count(b) FROM t1 WHERE a='a';
   627    627   } {
   628    628     SELECT min(c), count(c) FROM t1 WHERE a='a';
   629    629   } {1 5}
          630  +
          631  +# 2016-07-26.  https://www.sqlite.org/src/info/a0bac8b3c3d1bb75
          632  +# Incorrect result on a min() query after a CREATE INDEX.
          633  +#
          634  +do_execsql_test 14.1 {
          635  +  CREATE TABLE t14(a INTEGER, b INTEGER);
          636  +  INSERT INTO t14(a,b) VALUES(100,2),(200,2),(300,2),(400,1),(500,2);
          637  +  SELECT min(a) FROM t14 WHERE b='2' AND a>'50';
          638  +} {100}
          639  +do_execsql_test 14.2 {
          640  +  CREATE INDEX t14ba ON t14(b,a);
          641  +  SELECT min(a) FROM t14 WHERE b='2' AND a>'50';
          642  +} {100}
          643  +
   630    644   
   631    645   
   632    646   finish_test