-C Correctly\shandle\sCOLLATE\sclauses\sin\stables\sbeing\smodified\sby\san\nALTER\sTABLE\sADD\sCOLUMN\scommand.\s\sTicket\s#1665.\s(CVS\s3060)
-D 2006-02-09T02:56:03
+C Avoid\soverflowing\sthe\s48-bit\smantissa\sof\sa\sfloating\spoint\snumber\swhen\nsumming\slarge\sintegers\sin\sthe\sSUM()\sfunction.\s\sTicket\s#1664.\s(CVS\s3061)
+D 2006-02-09T13:38:20
F Makefile.in 5d8dff443383918b700e495de42ec65bc1c8865b
F Makefile.linux-gcc 74ba0eadf88748a9ce3fd03d2a3ede2e6715baec
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
F src/delete.c 56ab34c3a384caa5d5ea06f5739944957e2e4213
F src/experimental.c 1b2d1a6cd62ecc39610e97670332ca073c50792b
F src/expr.c 1149c3380bfce27703f5e9bec7dfb8e51baaf9d9
-F src/func.c 96b26601c092b7b43a13e440e3f988b32a385f6a
+F src/func.c b21d89f5a11634847c9ab3ead42e75586db538b2
F src/hash.c 8747cf51d12de46512880dfcf1b68b4e24072863
F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84
F src/insert.c 7e931b7f06afbcefcbbaab175c02eff8268db33f
F test/expr.test 4e65cade931e14a0194eee41e33707e7af5f397a
F test/fkey1.test 153004438d51e6769fb1ce165f6313972d6263ce
F test/format4.test 9f31d41d4f926cab97b2ebe6be00a6ab12dece87
-F test/func.test 337888172c054c2de1aa3bacad6115522943dc2c
+F test/func.test ef312ca92480e5bfa699c30643e4174247db686d
F test/hook.test 7e7645fd9a033f79cce8fdff151e32715e7ec50a
F test/in.test 40feeebc7e38576255051aad428322be1545e0f1
F test/index.test c478459611ded74745fee57f99f424da8a5f5fbd
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P 8b3068aca7b28d2b6c326f632bb9fe9b4940792d
-R 47553fd44adabe1f2b524acd7a9ad936
+P baef2f66be164910881278ea527d2be75ac2e944
+R 447165c89df570db65d416c0baa9b959
U drh
-Z 958b2cb828e348f813795762ac6399a1
+Z 308693939eb8035424937f098052bb3a
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
** All other code has file scope.
**
-** $Id: func.c,v 1.117 2006/01/17 13:21:40 danielk1977 Exp $
+** $Id: func.c,v 1.118 2006/02/09 13:38:20 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
*/
typedef struct SumCtx SumCtx;
struct SumCtx {
- double sum; /* Sum of terms */
- int cnt; /* Number of elements summed */
+ LONGDOUBLE_TYPE sum; /* Sum of terms */
+ u32 cnt; /* Number of elements summed */
u8 seenFloat; /* True if there has been any floating point value */
};
*/
typedef struct CountCtx CountCtx;
struct CountCtx {
- int n;
+ i64 n;
};
/*
static void countFinalize(sqlite3_context *context){
CountCtx *p;
p = sqlite3_aggregate_context(context, 0);
- sqlite3_result_int(context, p ? p->n : 0);
+ sqlite3_result_int64(context, p ? p->n : 0);
}
/*
# This file implements regression tests for SQLite library. The
# focus of this file is testing built-in functions.
#
-# $Id: func.test,v 1.44 2006/01/20 15:45:37 drh Exp $
+# $Id: func.test,v 1.45 2006/02/09 13:38:21 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
}
} {123}
+# Ticket #1664: 64-bit overflow in sum()
+#
+do_test func-18.10 {
+ execsql {
+ CREATE TABLE t6(x INTEGER);
+ INSERT INTO t6 VALUES(1);
+ INSERT INTO t6 VALUES(1<<62);
+ SELECT sum(x) - ((1<<62)+1) from t6;
+ }
+} 0
+
finish_test