]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Cherrypick of [c1152bdcbb] and fix for [9f2eb3abac]:
authordrh <drh@noemail.net>
Thu, 29 Aug 2013 13:15:09 +0000 (13:15 +0000)
committerdrh <drh@noemail.net>
Thu, 29 Aug 2013 13:15:09 +0000 (13:15 +0000)
Have the whereShortCut() planner ignore indexes with more than four columns.

FossilOrigin-Name: c3f75941e5dbd927142efb68e7c31904bafbfd70

manifest
manifest.uuid
src/where.c
test/tkt-9f2eb3abac.test [new file with mode: 0644]

index c25ddb40004ce99896eec59ccac7bec623ff3cd0..fbab06a59ca6dbfe74e0933f02d4c329a3d0c406 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Version\s3.8.0
-D 2013-08-26T04:50:08.905
+C Cherrypick\sof\s[c1152bdcbb]\sand\sfix\sfor\s[9f2eb3abac]:\nHave\sthe\swhereShortCut()\splanner\signore\sindexes\swith\smore\sthan\sfour\scolumns.
+D 2013-08-29T13:15:09.214
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 5e41da95d92656a5004b03d3576e8b226858a28e
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -290,7 +290,7 @@ F src/vtab.c 165ce0e797c2cd23badb104c9f2ae9042d6d942c
 F src/wal.c 7dc3966ef98b74422267e7e6e46e07ff6c6eb1b4
 F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
 F src/walker.c 4fa43583d0a84b48f93b1e88f11adf2065be4e73
-F src/where.c 6e718c39d6b2964f15f6c96ce5938b4652e3538e
+F src/where.c 53ac2441269b3adca28e2b8a8339f2dcaa50a9a2
 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
 F test/aggnested.test 45c0201e28045ad38a530b5a144b73cd4aa2cfd6
@@ -857,6 +857,7 @@ F test/tkt-868145d012.test a5f941107ece6a64410ca4755c6329b7eb57a356
 F test/tkt-91e2e8ba6f.test 08c4f94ae07696b05c9b822da0b4e5337a2f54c5
 F test/tkt-94c04eaadb.test fa9c71192f7e2ea2d51bf078bc34e8da6088bf71
 F test/tkt-9d68c883.test 458f7d82a523d7644b54b497c986378a7d8c8b67
+F test/tkt-9f2eb3abac.test 85bc63e749f050e6a61c8f9207f1eee65c9d3395
 F test/tkt-a7b7803e.test 159ef554234fa1f9fb318c751b284bd1cf858da4
 F test/tkt-b1d3a2e531.test 610ef582413171b379652663111b1f996d9f8f78
 F test/tkt-b351d95f9.test d14a503c414c5c58fdde3e80f9a3cfef986498c0
@@ -1105,10 +1106,11 @@ F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
 F tool/wherecosttest.c f407dc4c79786982a475261866a161cd007947ae
 F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
-P ed310201628cf79c0f57674ae7478ee6738b1c6e
-R 5a6ead2576f296902c1b2ccbdf985254
-T +bgcolor * #d0c0ff
-T +sym-release *
-T +sym-version-3.8.0 *
+P f64cd21e2e23ed7cff48f7dafa5e76adde9321c2
+Q +c1152bdcbb5ac185f743015fff63769effa81b4b
+R f37afa23588c87c948f6db62509a5540
+T *branch * branch-3.8.0
+T *sym-branch-3.8.0 *
+T -sym-trunk *
 U drh
-Z 16184cb835825e1de42c653d441df656
+Z f756b9e9da7f4f16b2922ea29f813ff5
index 83c0ca7e6f4acd6594d2134f5b7648f702e433c8..6fe4dd5e79ac9eeb1d7a27ac62afd3783b16361b 100644 (file)
@@ -1 +1 @@
-f64cd21e2e23ed7cff48f7dafa5e76adde9321c2
\ No newline at end of file
+c3f75941e5dbd927142efb68e7c31904bafbfd70
\ No newline at end of file
index 05e6824f016cbfc0ed5b18ac444e06a192281461..941b4d5e815267dba72c5e070b7bd2276c945a1f 100644 (file)
@@ -5546,11 +5546,15 @@ static int whereShortCut(WhereLoopBuilder *pBuilder){
     pLoop->rRun = 33;  /* 33==whereCost(10) */
   }else{
     for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
-      if( pIdx->onError==OE_None || pIdx->pPartIdxWhere!=0 ) continue;
+      assert( pLoop->aLTermSpace==pLoop->aLTerm );
+      assert( ArraySize(pLoop->aLTermSpace)==4 );
+      if( pIdx->onError==OE_None 
+       || pIdx->pPartIdxWhere!=0 
+       || pIdx->nColumn>ArraySize(pLoop->aLTermSpace) 
+      ) continue;
       for(j=0; j<pIdx->nColumn; j++){
         pTerm = findTerm(pWC, iCur, pIdx->aiColumn[j], 0, WO_EQ, pIdx);
         if( pTerm==0 ) break;
-        whereLoopResize(pWInfo->pParse->db, pLoop, j);
         pLoop->aLTerm[j] = pTerm;
       }
       if( j!=pIdx->nColumn ) continue;
diff --git a/test/tkt-9f2eb3abac.test b/test/tkt-9f2eb3abac.test
new file mode 100644 (file)
index 0000000..5b93733
--- /dev/null
@@ -0,0 +1,79 @@
+
+# 2013 August 29
+#
+# The author disclaims copyright to this source code.  In place of
+# a legal notice, here is a blessing:
+#
+#    May you do good and not evil.
+#    May you find forgiveness for yourself and forgive others.
+#    May you share freely, never taking more than you give.
+#
+#***********************************************************************
+# This file implements regression tests for SQLite library.
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+source $testdir/malloc_common.tcl
+set ::testprefix tkt-9f2eb3abac
+
+do_execsql_test 1.1 {
+  CREATE TABLE t1(a,b,c,d,e, PRIMARY KEY(a,b,c,d,e));
+  SELECT * FROM t1 WHERE a=? AND b=? AND c=? AND d=? AND e=?;
+} {}
+
+do_execsql_test 1.2 {
+  CREATE TABLE "a" (
+      "b" integer NOT NULL,
+      "c" integer NOT NULL,
+      PRIMARY KEY ("b", "c")
+      );
+
+  CREATE TABLE "d" (
+      "e" integer NOT NULL,
+      "g" integer NOT NULL,
+      "f" integer NOT NULL,
+      "h" integer NOT NULL,
+      "i" character(10) NOT NULL,
+      "j" int,
+      PRIMARY KEY ("e", "g", "f", "h")
+      );
+
+  CREATE TABLE "d_to_a" (
+      "f_e" integer NOT NULL,
+      "f_g" integer NOT NULL,
+      "f_f" integer NOT NULL,
+      "f_h" integer NOT NULL,
+      "t_b" integer NOT NULL,
+      "t_c" integer NOT NULL,
+      "r" character NOT NULL,
+      "s" integer,
+      PRIMARY KEY ("f_e", "f_g", "f_f", "f_h", "t_b", "t_c")
+      );
+
+  INSERT INTO d (g, e, h, f, j, i) VALUES ( 1, 1, 1, 1, 1, 1 );
+  INSERT INTO a (b, c) VALUES ( 1, 1 );
+  INSERT INTO d_to_a VALUES (1, 1, 1, 1, 1, 1, 1, 1);
+
+  DELETE FROM d_to_a 
+  WHERE f_g = 1 AND f_e = 1 AND f_h = 1 AND f_f = 1 AND t_b = 1 AND t_c = 1;
+
+  SELECT * FROM d_to_a;
+} {}
+
+faultsim_delete_and_reopen
+do_execsql_test 2.0 { CREATE TABLE t1(a,b,c,d,e, PRIMARY KEY(a,b,c,d,e)) }
+do_execsql_test 2.1 { CREATE TABLE t2(x) }
+faultsim_save_and_close
+
+do_faultsim_test 3 -faults oom* -prep {
+  faultsim_restore_and_reopen
+  execsql { SELECT 1 FROM sqlite_master }
+} -body {
+  execsql { SELECT * FROM t1,t2 WHERE a=? AND b=? AND c=? AND d=? AND e=? }
+} -test {
+  faultsim_test_result {0 {}} 
+}
+
+finish_test
+