]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
More bug fixes. But there are still tests that fail. (CVS 2664)
authordrh <drh@noemail.net>
Wed, 7 Sep 2005 22:48:16 +0000 (22:48 +0000)
committerdrh <drh@noemail.net>
Wed, 7 Sep 2005 22:48:16 +0000 (22:48 +0000)
FossilOrigin-Name: 7e85a162d0ecf0acdbffcacc62b60d97fe123881

manifest
manifest.uuid
src/expr.c
src/select.c
src/sqliteInt.h
test/collate5.test
test/misc4.test
test/select5.test
test/select6.test

index 7c04d369fb24680c62e7d509428f6501b32e87b8..7de9fa57234ec7693f9143f20c6611d36e2322d4 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Bug\sfixes\sin\saggregate\sprocessing.\s\sFewer\stests\sfail.\s(CVS\s2663)
-D 2005-09-07T22:09:48
+C More\sbug\sfixes.\s\sBut\sthere\sare\sstill\stests\sthat\sfail.\s(CVS\s2664)
+D 2005-09-07T22:48:16
 F Makefile.in 12784cdce5ffc8dfb707300c34e4f1eb3b8a14f1
 F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -40,7 +40,7 @@ F src/complete.c 4de937dfdd4c79a501772ab2035b26082f337a79
 F src/date.c 7444b0900a28da77e57e3337a636873cff0ae940
 F src/delete.c be1fc25c9e109cd8cbab42a43ee696263da7c04b
 F src/experimental.c 50c1e3b34f752f4ac10c36f287db095c2b61766d
-F src/expr.c e0a3f275586bb076cc5995885a328b531b5aecf2
+F src/expr.c 38f1e135aa80dfc62e253c1e22dd6e194efd2d61
 F src/func.c 713cf33a0ab8685d44ed31a9c753983a7ff9fd6e
 F src/hash.c 2b1b13f7400e179631c83a1be0c664608c8f021f
 F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84
@@ -63,10 +63,10 @@ F src/pragma.c 69413fbdc0c6aaa493a776ea52c1b3e6cf35dfb2
 F src/prepare.c 86f0d8e744b8d956eff6bc40e29049efee017610
 F src/printf.c c01e9ad473d79463fb1f483b1eca5c3cbed2a4e5
 F src/random.c 90adff4e73a3b249eb4f1fc2a6ff9cf78c7233a4
-F src/select.c 25df0f7aa195aebb9c34b04b4de4a9ef412d2341
+F src/select.c 4549cbef5d8bb98004374de533b6e45c5d73da6c
 F src/shell.c b21daba017b8feef2fdc65ecde57f70209494217
 F src/sqlite.h.in d6561d51025d08de4f455607f3f9f9aa76e855d5
-F src/sqliteInt.h 97d7d13bfcccd67974b0db9c19fce4428ae9d236
+F src/sqliteInt.h b7d841739ce478a299e46db5ebcb510e833a36c5
 F src/table.c 25b3ff2b39b7d87e8d4a5da0713d68dfc06cbee9
 F src/tclsqlite.c ac94682f9e601dd373912c46414a5a842db2089a
 F src/test1.c b569b60e35f0e3ea20e5ebfaf6e522a01c08d481
@@ -127,7 +127,7 @@ F test/collate1.test f79736d2ebf5492167ee4d1f4ab4c09dda776b03
 F test/collate2.test 224a632ba04907c049804b08162efd234aa7871f
 F test/collate3.test 51362bdfb43a72bd2b087d90b2623b0695538e7a
 F test/collate4.test daf498e294dcd596b961d425c3f2dda117e4717e
-F test/collate5.test 5a49cd169e7565e4f92b42695667d6d5db25670d
+F test/collate5.test 8fb4e7e0241839356bd8710f437c32efb47bfff8
 F test/collate6.test 6c9470d1606ee3e564675b229653e320c49ec638
 F test/conflict.test 774e10709f5e9a9a7352dc929b856929ec805e58
 F test/corrupt.test 18c7a995b1af76a8c8600b996257f2c7b7bff083
@@ -178,7 +178,7 @@ F test/minmax.test 9429a06f1f93acf76fcacafd17160a4392e88526
 F test/misc1.test 4ca69ca2e2ef33c7a0b0fc8b324111e37a522d29
 F test/misc2.test 5c699af2fede2694736a9f45aea7e2f052686e15
 F test/misc3.test 7bd937e2c62bcc6be71939faf068d506467b1e03
-F test/misc4.test 8a28f046bac8121dc2fe623ccb75578cd51b9db0
+F test/misc4.test 879b1eedac550b70fd3f2b7cb993505927459ed3
 F test/misc5.test 24bd03404039ec727028ac9cf7fd9066fd209ec9
 F test/misuse.test 1c7fee3c4c0cb4008717ecccf5c72281fac0008e
 F test/notnull.test 7a08117a71e74b0321aaa937dbeb41a09d6eb1d0
@@ -201,8 +201,8 @@ F test/select1.test ad700a2a1c325a23a7206ad4d189e33917de526f
 F test/select2.test f3c2678c3a9f3cf08ec4988a3845bda64be6d9e3
 F test/select3.test 44dccad96a1b9940bb8c6f982d4d218dcd262760
 F test/select4.test c239f516aa31f42f2ef7c6d7cd01105f08f934ca
-F test/select5.test ae1b5ee2485c5fdc610207a391cfdc23e59c7834
-F test/select6.test 6559d16ad16edb7d6864f7e74a3d204d0af72486
+F test/select5.test 1e2258ed2a660a2d0e2f44866712a2299f617a9e
+F test/select6.test 21b72c56e7cbcefd063fdf9bc6c89342aedabccf
 F test/select7.test 1bf795b948c133a15a2a5e99d3270e652ec58ce6
 F test/sort.test 0c33a8ae1c238377ad197387c3872175f40d3843
 F test/subquery.test ed4ecba1afacb586c86fad1cdb92756a48a90302
@@ -306,7 +306,7 @@ F www/tclsqlite.tcl 3df553505b6efcad08f91e9b975deb2e6c9bb955
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P 17039ec3ff4396862beedf4a8af89654b2140f58
-R 6c06595443fe21ccea4edb3f23aa8075
+P c3ac58592f5e6305640868cdf42c129f1a25255d
+R 6c256278770a26042f2e6a36de48258d
 U drh
-Z 5adf4da7e52b069f7d7876deaf8155c7
+Z 0657ca6eb3310d093b7ef2bd702d44bc
index 1b2d1e5fe2868ac0d61be4b9767fbe0833c5fcc4..7ec95cd2a66fae21f72d792a1e00860965a373a6 100644 (file)
@@ -1 +1 @@
-c3ac58592f5e6305640868cdf42c129f1a25255d
\ No newline at end of file
+7e85a162d0ecf0acdbffcacc62b60d97fe123881
\ No newline at end of file
index ac37e507fc8b67ab479269f525c9c2d41d680870..b71bde75009533ef661f3e216791a25cdce3d79d 100644 (file)
@@ -12,7 +12,7 @@
 ** This file contains routines used for analyzing expressions and
 ** for generating VDBE code that evaluates expressions in SQLite.
 **
-** $Id: expr.c,v 1.225 2005/09/07 21:22:46 drh Exp $
+** $Id: expr.c,v 1.226 2005/09/07 22:48:16 drh Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -2131,6 +2131,7 @@ static int analyzeAggregate(void *pArg, Expr *pExpr){
               pCol->iColumn = pExpr->iColumn;
               pCol->iMem = pParse->nMem++;
               pCol->iSorterColumn = -1;
+              pCol->pExpr = pExpr;
               if( pAggInfo->pGroupBy ){
                 int j, n;
                 ExprList *pGB = pAggInfo->pGroupBy;
index 07e1339a492da707db87554affc163a9684912c4..be5dce3f083c620fbcce014dbced81cce82bbbaf 100644 (file)
@@ -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.262 2005/09/07 22:09:48 drh Exp $
+** $Id: select.c,v 1.263 2005/09/07 22:48:16 drh Exp $
 */
 #include "sqliteInt.h"
 
@@ -2446,7 +2446,6 @@ static void updateAccumulator(Parse *pParse, AggInfo *pAggInfo){
   int i;
   struct AggInfo_func *pF;
   struct AggInfo_col *pC;
-  Expr fauxExpr;
 
   pAggInfo->directMode = 1;
   for(i=0, pF=pAggInfo->aFunc; i<pAggInfo->nFunc; i++, pF++){
@@ -2472,12 +2471,8 @@ static void updateAccumulator(Parse *pParse, AggInfo *pAggInfo){
     }
     sqlite3VdbeOp3(v, OP_AggStep, pF->iMem, nArg, (void*)pF->pFunc, P3_FUNCDEF);
   }
-  memset(&fauxExpr, 0, sizeof(fauxExpr));
-  fauxExpr.op = TK_AGG_COLUMN;
-  fauxExpr.pAggInfo = pAggInfo;
   for(i=0, pC=pAggInfo->aCol; i<pAggInfo->nAccumulator; i++, pC++){
-    fauxExpr.iAgg = i;
-    sqlite3ExprCode(pParse, &fauxExpr);
+    sqlite3ExprCode(pParse, pC->pExpr);
     sqlite3VdbeAddOp(v, OP_MemStore, pC->iMem, 1);
   }
   pAggInfo->directMode = 0;
@@ -2990,6 +2985,9 @@ int sqlite3Select(
       sqlite3WhereEnd(pWInfo);
       finalizeAggFunctions(pParse, &sAggInfo);
       pOrderBy = 0;
+      if( pHaving ){
+        sqlite3ExprIfFalse(pParse, pHaving, addrEnd, 1);
+      }
       selectInnerLoop(pParse, p, p->pEList, 0, 0, 0, -1, 
                       eDest, iParm, addrEnd, addrEnd, aff);
     }
index 16ab6ae2fa25089634d07121ad15411b5f94bb93..f3ee4752a36052d196f5c8b78a284b1362620672 100644 (file)
@@ -11,7 +11,7 @@
 *************************************************************************
 ** Internal interface definitions for SQLite.
 **
-** @(#) $Id: sqliteInt.h,v 1.408 2005/09/07 21:22:47 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.409 2005/09/07 22:48:16 drh Exp $
 */
 #ifndef _SQLITEINT_H_
 #define _SQLITEINT_H_
@@ -814,6 +814,7 @@ struct AggInfo {
     int iColumn;             /* Column number within the source table */
     int iSorterColumn;       /* Column number in the sorting index */
     int iMem;                /* Memory location that acts as accumulator */
+    Expr *pExpr;             /* The original expression */
   } *aCol;
   int nColumn;            /* Number of used entries in aCol[] */
   int nColumnAlloc;       /* Number of slots allocated for aCol[] */
index 76cc70612d263b94a5f665dd77c723b5da4c55fa..5e63c1f4c3f4b8463639cce9977d58d76c86238c 100644 (file)
@@ -14,7 +14,7 @@
 # SELECT statements that use user-defined collation sequences. Also
 # GROUP BY clauses that use user-defined collation sequences.
 #
-# $Id: collate5.test,v 1.4 2005/04/01 10:47:40 drh Exp $
+# $Id: collate5.test,v 1.5 2005/09/07 22:48:16 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -252,15 +252,15 @@ do_test collate5-4.0 {
   }
 } {}
 do_test collate5-4.1 {
-  execsql {
+  string tolower [execsql {
     SELECT a, count(*) FROM collate5t1 GROUP BY a;
-  }
+  }]
 } {a 2 b 2}
 do_test collate5-4.2 {
   execsql {
-    SELECT a, b, count(*) FROM collate5t1 GROUP BY a, b;
+    SELECT a, b, count(*) FROM collate5t1 GROUP BY a, b ORDER BY a, b;
   }
-} {a 1 2 b 2 1 B 3 1}
+} {A 1.0 2 b 2 1 B 3 1}
 do_test collate5-4.3 {
   execsql {
     DROP TABLE collate5t1;
index 31bd68480165e4450ff3c375bc8ea8c1ea875b80..0a8dbd539906cedfc2a9f04309f6e3826a941766 100644 (file)
@@ -13,7 +13,7 @@
 # This file implements tests for miscellanous features that were
 # left out of other test files.
 #
-# $Id: misc4.test,v 1.17 2005/09/07 21:22:47 drh Exp $
+# $Id: misc4.test,v 1.18 2005/09/07 22:48:16 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -99,7 +99,7 @@ do_test misc4-3.1 {
        UNION SELECT ID, max(Value) FROM Table2 GROUP BY 1
     ORDER BY 1, 2;
   }
-} {{} {} 1 x 1 z}
+} {1 x 1 z}
 } ;# ifcapable compound
 
 # Ticket #1047.  Make sure column types are preserved in subqueries.
index d8e7b89d9d3b46964771a641fdd0aa5bc72bd9ac..57fe9ca54944cbdb8948d678c31d74b0cdbe8185 100644 (file)
@@ -12,7 +12,7 @@
 # focus of this file is testing aggregate functions and the
 # GROUP BY and HAVING clauses of SELECT statements.
 #
-# $Id: select5.test,v 1.10 2005/08/19 03:03:52 drh Exp $
+# $Id: select5.test,v 1.11 2005/09/07 22:48:16 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -154,6 +154,6 @@ do_test select5-5.5 {
   execsql {
     SELECT a, b FROM t2 GROUP BY a;
   } 
-} {1 2 6 4}
+} {1 4 6 4}
 
 finish_test
index fced37f3bde4fdb8caa5af3d735319aa39092701..4eb6f0ec15c031e3a8fbbf865a60edbc29e24b49 100644 (file)
@@ -12,7 +12,7 @@
 # focus of this file is testing SELECT statements that contain
 # subqueries in their FROM clause.
 #
-# $Id: select6.test,v 1.18 2005/07/08 17:13:47 drh Exp $
+# $Id: select6.test,v 1.19 2005/09/07 22:48:16 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -194,6 +194,7 @@ do_test select6-3.6 {
   }
 } {10.5 3.7 14.2}
 do_test select6-3.7 {
+btree_breakpoint
   execsql {
     SELECT a,b,a+b FROM (SELECT avg(x) as 'a', avg(y) as 'b' FROM t1)
     WHERE a<10