]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
If a unique index covers any prefix of the ORDER BY clause then let it
authordrh <drh@noemail.net>
Wed, 25 Jun 2008 02:47:57 +0000 (02:47 +0000)
committerdrh <drh@noemail.net>
Wed, 25 Jun 2008 02:47:57 +0000 (02:47 +0000)
satisfy the ORDER BY clause. (CVS 5301)

FossilOrigin-Name: e53403b6d742be83c5b130ed6cef4035d081d613

manifest
manifest.uuid
src/where.c
test/misc3.test
test/selectA.test

index 3242ca9b8844296bd929dfa2f0a29ade7399968f..32001f7542ecfd64877adb440c01137c82900334 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\snew\stest\sscript\sfor\scompound\sselect\sstatements.\s(CVS\s5300)
-D 2008-06-25T02:22:32
+C If\sa\sunique\sindex\scovers\sany\sprefix\sof\sthe\sORDER\sBY\sclause\sthen\slet\sit\nsatisfy\sthe\sORDER\sBY\sclause.\s(CVS\s5301)
+D 2008-06-25T02:47:57
 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
 F Makefile.in ff6f90048555a0088f6a4b7406bed5e55a7c4eff
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -190,7 +190,7 @@ F src/vdbeblob.c 9345f6dcd675fdcfdb537d2d2f487542d9ea136a
 F src/vdbefifo.c c46dae1194e4277bf007144d7e5b0c0b1c24f136
 F src/vdbemem.c a39a822e6ae61c4cab4a512df4a315888b206911
 F src/vtab.c 2096c03ec5540a43c8c73a8f43407dfd3549a982
-F src/where.c 5c4a999f6aed992131479bfaec9b874326d9963c
+F src/where.c 767db25b4b92a5e0a6f1b75ba40abf377b65a212
 F tclinstaller.tcl 4356d9d94d2b5ed5e68f9f0c80c4df3048dd7617
 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
 F test/all.test ed6849e7a425620d5d4388409f3b15901b5bc2e7
@@ -406,7 +406,7 @@ F test/minmax2.test 33504c01a03bd99226144e4b03f7631a274d66e0
 F test/minmax3.test 05110398e065875b3d9315892889d3c87fccfe2b
 F test/misc1.test 1b89c02c4a33b49dee4cd1d20d161aaaba719075
 F test/misc2.test 1ee89298de9c16b61454658b24999c403e86afe4
-F test/misc3.test aea079f4c3d93e9962186f45c0ff0954310e6b11
+F test/misc3.test 7212ed8dad01427e9acab9bd3e7e5e2c2e89be9e
 F test/misc4.test 91e8ed25c092c2bb4e0bb01864631e2930f8d7de
 F test/misc5.test 0b68dcb630d44af2dbcdca94dd2b17c8d580f6fa
 F test/misc6.test 953cc693924d88e6117aeba16f46f0bf5abede91
@@ -447,7 +447,7 @@ F test/select6.test 399f14b9ba37b768afe5d2cd8c12e4f340a69db8
 F test/select7.test 7906735805cfbee4dddc0bed4c14e68d7f5f9c5f
 F test/select8.test 391de11bdd52339c30580dabbbbe97e3e9a3c79d
 F test/select9.test 0e1a5470bac7e6daa757d8df3fbfaee6730c544e
-F test/selectA.test 8d7e8787fd461f7aff2b276bcfdc7d1d38db21e9
+F test/selectA.test 45263e0936f654ddbd0c451b49790d9956f3b921
 F test/server1.test f5b790d4c0498179151ca8a7715a65a7802c859c
 F test/shared.test c6769531e0cb751d46a9838c0532d3786606c0f6
 F test/shared2.test 0ee9de8964d70e451936a48c41cb161d9134ccf4
@@ -594,7 +594,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 8bbfa97837a74ef0514e0c92ea2a6576f02cc361
-R d3d63954a19224d9d12c86b40b9ad68f
+P a193b1612e7ccd1c8f6136ece8d4768fccfe43fe
+R 73462fba25fb2aaffa637b9f2f37ff8b
 U drh
-Z 3497cca5a2b0cf3fe586a565ff57add5
+Z 1818408e0a699a7a27b7b1a57b585fce
index 86a7fdb2d05642af07c7b53d4355de12637d04c2..eac2bd5ef41539045c9afb484f0e69a0812a2900 100644 (file)
@@ -1 +1 @@
-a193b1612e7ccd1c8f6136ece8d4768fccfe43fe
\ No newline at end of file
+e53403b6d742be83c5b130ed6cef4035d081d613
\ No newline at end of file
index 3a14bf3211880cffa38cd286e03ae67271b09ce5..a5ba55f0db254aace60e911b6ac6afd0339076e7 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.309 2008/06/15 02:51:48 drh Exp $
+** $Id: where.c,v 1.310 2008/06/25 02:47:57 drh Exp $
 */
 #include "sqliteInt.h"
 
@@ -1089,6 +1089,9 @@ static int isSortingIndex(
         ** ORDER BY term, that is OK.  Just ignore that column of the index
         */
         continue;
+      }else if( i==pIdx->nColumn ){
+        /* Index column i is the rowid.  All other terms match. */
+        break;
       }else{
         /* If an index column fails to match and is not constrained by ==
         ** then the index cannot satisfy the ORDER BY constraint.
index 89881e4aa9ccb2b917fbaa3e83d69528b3e51cb9..1534aaf37061b235682f8642b2464c2529237cb0 100644 (file)
@@ -13,7 +13,7 @@
 # This file implements tests for miscellanous features that were
 # left out of other test files.
 #
-# $Id: misc3.test,v 1.18 2008/01/19 23:50:26 drh Exp $
+# $Id: misc3.test,v 1.19 2008/06/25 02:47:57 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -274,7 +274,7 @@ ifcapable {explain} {
   } {1}
   do_test misc3-6.11 {
     set x [execsql {
-      EXPLAIN SELECT a+123456789012, b*4.5678, c FROM ex1 ORDER BY a, b DESC
+      EXPLAIN SELECT a+123456789012, b*4.5678, c FROM ex1 ORDER BY +a, b DESC
     }]
     set y [regexp { 123456789012 } $x]
     lappend y [regexp { 4.5678 } $x]
index 42eaa706e0ddf893b27ae7243fc7db641b190e6d..13ab2bcef88b6b86ab75aa46b95b74553523f296 100644 (file)
@@ -17,7 +17,7 @@
 # explicit sort order and explicit collating secquites) and
 # with and without optional LIMIT and OFFSET clauses.
 #
-# $Id: selectA.test,v 1.1 2008/06/25 02:22:32 drh Exp $
+# $Id: selectA.test,v 1.2 2008/06/25 02:47:57 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl