]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Make sure the reverse_unordered_selects pragma works even on unindexed
authordrh <drh@noemail.net>
Mon, 6 Apr 2009 12:26:57 +0000 (12:26 +0000)
committerdrh <drh@noemail.net>
Mon, 6 Apr 2009 12:26:57 +0000 (12:26 +0000)
tables that are queried without a WHERE clause (CVS 6453)

FossilOrigin-Name: d8c6b28a734fccbbbd567d98ffa7e6557280f737

manifest
manifest.uuid
src/where.c
test/whereA.test

index 3508685a8b41bdb004d0a7f79b5f7f6472fa17a0..a66cf4d508e75b91fc625740cb86ac12ab0a91c6 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Check-in\s(6450)\sintroduced\sthe\spossibility\sof\scalling\smemset()\swith\sa\nnegative\s3rd\sargument.\s\sThis\sfixes\sthat\sbug.\s\sTicket\s#3777.\s(CVS\s6452)
-D 2009-04-06T11:11:43
+C Make\ssure\sthe\sreverse_unordered_selects\spragma\sworks\seven\son\sunindexed\ntables\sthat\sare\squeried\swithout\sa\sWHERE\sclause\s(CVS\s6453)
+D 2009-04-06T12:26:58
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -209,7 +209,7 @@ F src/vdbeblob.c e67757450ae8581a8b354d9d7e467e41502dfe38
 F src/vdbemem.c 9798905787baae83d0b53b62030e32ecf7a0586f
 F src/vtab.c f1aba5a6dc1f83b97a39fbbc58ff8cbc76311347
 F src/walker.c 42bd3f00ca2ef5ae842304ec0d59903ef051412d
-F src/where.c 5a421d7265c79dc21c010e3218fd3abd448ec297
+F src/where.c 0eeb451ecbba411fa5dacd8181244c57453bd1c8
 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
 F test/alias.test 597662c5d777a122f9a3df0047ea5c5bd383a911
 F test/all.test 14165b3e32715b700b5f0cbf8f6e3833dda0be45
@@ -689,7 +689,7 @@ F test/where7.test 2487cda68faabf5edeb524289913f00f8d64e223
 F test/where8.test 1b9152a086408ee789166d0a954abc597372f868
 F test/where8m.test c1010d61826412ff66abd29bfb32e5d6b37d965c
 F test/where9.test 12c1e46364fb245ff84253758dd76dacc7bfe619
-F test/whereA.test ef8d699d87934bd747119c75fbb4711b584a8b60
+F test/whereA.test 522469ca013ff97c81b5367e730042290889a061
 F test/wherelimit.test 5e9fd41e79bb2b2d588ed999d641d9c965619b31
 F test/zeroblob.test 792124852ec61458a2eb527b5091791215e0be95
 F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
@@ -715,7 +715,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 4424aee958b2e764a61141b5c66c063e36ed5aae
-R 43e6aecc78e9f6e0e77380914acd3bdb
+P 8ca612c42e0de3ef5b2f92d80a56db1bef34b1c6
+R dfbacba56708d373c01317fe8f0ba945
 U drh
-Z 14516626e5d5c461983ced4b758a4b3b
+Z 5f95be47b5303e9e43b1ac41b9b703eb
index d6077a2773660ecdae3e0768f35b0260ce46f02d..2a2fa17a539d5b077028e17b7378786d5131edee 100644 (file)
@@ -1 +1 @@
-8ca612c42e0de3ef5b2f92d80a56db1bef34b1c6
\ No newline at end of file
+d8c6b28a734fccbbbd567d98ffa7e6557280f737
\ No newline at end of file
index 1cd9902fd995ad7bc492d9d1f9851efa544e3f43..b11a96ac2f1333367425097fb059b8a2feb4606b 100644 (file)
@@ -16,7 +16,7 @@
 ** so is applicable.  Because this module is responsible for selecting
 ** indices, you might also think of this module as the "query optimizer".
 **
-** $Id: where.c,v 1.379 2009/03/29 00:15:54 drh Exp $
+** $Id: where.c,v 1.380 2009/04/06 12:26:58 drh Exp $
 */
 #include "sqliteInt.h"
 
@@ -1762,6 +1762,13 @@ static void bestIndex(
   if( pProbe==0 &&
      findTerm(pWC, iCur, -1, 0, WO_EQ|WO_IN|WO_LT|WO_LE|WO_GT|WO_GE,0)==0 &&
      (pOrderBy==0 || !sortableByRowid(iCur, pOrderBy, pWC->pMaskSet, &rev)) ){
+     if( pParse->db->flags & SQLITE_ReverseOrder ){
+      /* For application testing, randomly reverse the output order for
+      ** SELECT statements that omit the ORDER BY clause.  This will help
+      ** to find cases where
+      */
+      pCost->plan.wsFlags |= WHERE_REVERSE;
+    }
     return;
   }
   pCost->rCost = SQLITE_BIG_DBL;
index 4f3780f662f908e6194be88b1ef90541736da4b6..a6f1723c610ed8833fccd8c33033db739751660a 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library. The
 # focus of this file is testing the reverse_select_order pragma.
 #
-# $Id: whereA.test,v 1.1 2009/02/23 16:52:08 drh Exp $
+# $Id: whereA.test,v 1.2 2009/04/06 12:26:58 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -78,4 +78,14 @@ do_test whereA-3.3 {
   }
 } {1 2 3 3 4.53 {} 2 hello world}
 
+do_test whereA-4.1 {
+  db eval {
+    CREATE TABLE t2(x);
+    INSERT INTO t2 VALUES(1);
+    INSERT INTO t2 VALUES(2);
+    SELECT x FROM t2;
+  }
+} {2 1}
+
+
 finish_test