From: drh Date: Mon, 23 Jan 2006 18:42:21 +0000 (+0000) Subject: Bug fix in cases where a compound select has an ORDER BY clause with X-Git-Tag: version-3.6.10~3156 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=a86a5b6c7e479f12a7f5919925ae636483e8a330;p=thirdparty%2Fsqlite.git Bug fix in cases where a compound select has an ORDER BY clause with multiple terms. (CVS 3011) FossilOrigin-Name: 4f56949bd69fed6167fa2ae115d0251e8369d796 --- diff --git a/manifest b/manifest index 9e4d5d4c95..1c64a8da35 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sdocumentation\son\sthe\sIF\sNOT\sEXISTS\sclause\sto\sCREATE\sstatements.\nTicket\s#1608.\s(CVS\s3010) -D 2006-01-23T18:14:22 +C Bug\sfix\sin\scases\swhere\sa\scompound\sselect\shas\san\sORDER\sBY\sclause\swith\nmultiple\sterms.\s(CVS\s3011) +D 2006-01-23T18:42:21 F Makefile.in 53841eb72e9eeb6030a8ce28c2595a92f440fd10 F Makefile.linux-gcc 74ba0eadf88748a9ce3fd03d2a3ede2e6715baec F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -66,7 +66,7 @@ F src/pragma.c 4496cc77dc35824e1c978c3d1413b8a5a4c777d3 F src/prepare.c 6349208568d7967a3d1b6625e5af736fd0d5d264 F src/printf.c f47a2f4b5387cd2ebb12e9117a1a5d6bd9a2b812 F src/random.c d40f8d356cecbd351ccfab6eaedd7ec1b54f5261 -F src/select.c 11ad28afb33bb83b655074c87557d4686c67f92f +F src/select.c 8b3ffcb68f05e88b7f1a3089161511ea8ed0f21a F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96 F src/shell.c 66b073375efbdee19045e7e0cd38b85f9aff71da F src/sqlite.h.in 492580f7e3ff71eb43193eb7bb98e2d549889ce3 @@ -118,7 +118,7 @@ F test/avtrans.test 49a319fc423a133432179e060824d1c10260714d F test/between.test 16b1776c6323faadb097a52d673e8e3d8be7d070 F test/bigfile.test ebc9ce9216e08bead63734ab816d0f27858f3b80 F test/bigrow.test f0aeb7573dcb8caaafea76454be3ade29b7fc747 -F test/bind.test 7c01e8a660e33586bc0c1d596d5a7a7f5e7523fe +F test/bind.test 238612427136404738a5a74323885923991d7dad F test/bindxfer.test b76bfb7df68bb0b238039f4543a84e9612291b54 F test/blob.test 28c3b25150684ee3d108bb78cfb67a472deef2f0 F test/btree.test 8aa7424aeec844df990273fe36447e5d7e407261 @@ -169,7 +169,7 @@ F test/index2.test 9ad98243fd7fe833795a9cc662f371f0eed4ff4f F test/index3.test f66718cd92ce1216819d47e6a156755e4b2c4ca1 F test/insert.test b4d43f8e75e203fe51bc06cacf3636081903dcd1 F test/insert2.test 5a20e1ace5fa0800b58d28284212290189b49aed -F test/insert3.test c67f0240b1c17e71fa2ed8bb6de064928f549f95 +F test/insert3.test 0096bd9766f94f4fa06ef712658e590b782cb44f F test/interrupt.test cd24dc5bedd02325be4bfa5d6209fae01c465157 F test/intpkey.test af4fd826c4784ec5c93b444de07adea0254d0d30 F test/ioerr.test 35637957d7d5c6385bd94e8a6f067b5016219c03 @@ -344,7 +344,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 -P 7addf70445d46cab148496ba2f27ab3764b70f66 -R 4292464c44eb181bca9cbae1286aaf63 +P d4e4ba132a94e729ffd220e0ca942cfda87b3a76 +R 935ea48d67ecae6891d4d9d675698801 U drh -Z 084b0c92b7e97fe9d76e7f212b9e5b45 +Z a3b3f8b0a1e4fd9d0941a3edc1f177da diff --git a/manifest.uuid b/manifest.uuid index 1167513591..c8d50bdd5f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d4e4ba132a94e729ffd220e0ca942cfda87b3a76 \ No newline at end of file +4f56949bd69fed6167fa2ae115d0251e8369d796 \ No newline at end of file diff --git a/src/select.c b/src/select.c index e507d4f2a8..d5c5254667 100644 --- a/src/select.c +++ b/src/select.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** -** $Id: select.c,v 1.299 2006/01/22 21:52:57 drh Exp $ +** $Id: select.c,v 1.300 2006/01/23 18:42:21 drh Exp $ */ #include "sqliteInt.h" @@ -1869,7 +1869,7 @@ static int multiSelect( int addr; u8 *pSortOrder; - aCopy = (CollSeq**)&pKeyInfo[1]; + aCopy = &pKeyInfo->aColl[nCol]; pSortOrder = pKeyInfo->aSortOrder = (u8*)&aCopy[nCol]; memcpy(aCopy, pKeyInfo->aColl, nCol*sizeof(CollSeq*)); apColl = pKeyInfo->aColl; diff --git a/test/bind.test b/test/bind.test index 328538885e..3a2e2d3dce 100644 --- a/test/bind.test +++ b/test/bind.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this script testing the sqlite_bind API. # -# $Id: bind.test,v 1.36 2006/01/03 00:33:50 drh Exp $ +# $Id: bind.test,v 1.37 2006/01/23 18:42:21 drh Exp $ # set testdir [file dirname $argv0] @@ -451,7 +451,7 @@ do_test bind-10.10 { # Ticket #918 # do_test bind-10.11 { - catch {sqlite3_finalize $VM} + # catch {sqlite3_finalize $VM} set VM [ sqlite3_prepare $DB { INSERT INTO t2(a,b,c,d,e,f) VALUES(:abc,?,?4,:pqr,:abc,?4) diff --git a/test/insert3.test b/test/insert3.test index b2999ff954..a6a3a6bf72 100644 --- a/test/insert3.test +++ b/test/insert3.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this file is testing corner cases of the INSERT statement. # -# $Id: insert3.test,v 1.3 2005/01/29 08:32:46 danielk1977 Exp $ +# $Id: insert3.test,v 1.4 2006/01/23 18:42:21 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -59,13 +59,19 @@ do_test insert3-1.3 { } } {hi 1} ifcapable compound { - do_test insert3-1.4 { + do_test insert3-1.4.1 { execsql { INSERT INTO t1 SELECT * FROM t1; SELECT 'a:', x, y FROM log UNION ALL SELECT 'b:', x, y FROM log2 ORDER BY x; } } {a: 5 4 b: 10 2 b: 20 1 a: 453 2 a: hello 4 b: hi 2 b: world 1} + do_test insert3-1.4.2 { + execsql { + SELECT 'a:', x, y FROM log UNION ALL + SELECT 'b:', x, y FROM log2 ORDER BY x, y; + } + } {a: 5 4 b: 10 2 b: 20 1 a: 453 2 a: hello 4 b: hi 2 b: world 1} do_test insert3-1.5 { execsql { INSERT INTO t1(a) VALUES('xyz');