diff options
author | drh <drh@noemail.net> | 2005-09-08 10:37:01 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2005-09-08 10:37:01 +0000 |
commit | 3d1d95e625582f31c794267f5ebb6c90aef8b6ba (patch) | |
tree | 342263b1804122809f7275601923736b3116f8d0 | |
parent | d49c16ee9b04d1eaf86357803d12584b35ef60b4 (diff) | |
download | sqlite-3d1d95e625582f31c794267f5ebb6c90aef8b6ba.tar.gz sqlite-3d1d95e625582f31c794267f5ebb6c90aef8b6ba.zip |
The SUM() aggregate function returns an integer result if all inputs are
integers. Any single non-integer input causes the result to be a floating
point value. (CVS 2669)
FossilOrigin-Name: 21adf4bd99e732650a1e8e9a1cc954126983a654
-rw-r--r-- | manifest | 40 | ||||
-rw-r--r-- | manifest.uuid | 2 | ||||
-rw-r--r-- | src/func.c | 16 | ||||
-rw-r--r-- | test/autovacuum.test | 6 | ||||
-rw-r--r-- | test/func.test | 21 | ||||
-rw-r--r-- | test/limit.test | 4 | ||||
-rw-r--r-- | test/minmax.test | 4 | ||||
-rw-r--r-- | test/misc1.test | 6 | ||||
-rw-r--r-- | test/misc4.test | 4 | ||||
-rw-r--r-- | test/null.test | 2 | ||||
-rw-r--r-- | test/select1.test | 10 | ||||
-rw-r--r-- | test/select3.test | 4 | ||||
-rw-r--r-- | test/select5.test | 4 | ||||
-rw-r--r-- | test/subquery.test | 8 | ||||
-rw-r--r-- | test/subselect.test | 6 | ||||
-rw-r--r-- | test/trigger2.test | 4 | ||||
-rw-r--r-- | test/where.test | 4 |
17 files changed, 86 insertions, 59 deletions
@@ -1,5 +1,5 @@ -C Changes\sto\scomments\sonly\sin\ssqliteInt.h.\s\sNo\schanges\sto\scode.\s(CVS\s2668) -D 2005-09-08T02:00:26 +C The\sSUM()\saggregate\sfunction\sreturns\san\sinteger\sresult\sif\sall\sinputs\sare\nintegers.\s\sAny\ssingle\snon-integer\sinput\scauses\sthe\sresult\sto\sbe\sa\sfloating\npoint\svalue.\s(CVS\s2669) +D 2005-09-08T10:37:01 F Makefile.in 12784cdce5ffc8dfb707300c34e4f1eb3b8a14f1 F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -41,7 +41,7 @@ F src/date.c 7444b0900a28da77e57e3337a636873cff0ae940 F src/delete.c 16a0e19460b14d219f39ff5c7a9eef808aa1969c F src/experimental.c 50c1e3b34f752f4ac10c36f287db095c2b61766d F src/expr.c 38f1e135aa80dfc62e253c1e22dd6e194efd2d61 -F src/func.c 713cf33a0ab8685d44ed31a9c753983a7ff9fd6e +F src/func.c c1027f4fcb4aaf7118e2b8ed7bbc33c709f2128e F src/hash.c 2b1b13f7400e179631c83a1be0c664608c8f021f F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84 F src/insert.c 484c73bc1309f283a31baa0e114f3ee980536397 @@ -101,7 +101,7 @@ F test/attach3.test 63013383adc4380af69779f34f4af19bd49f7cbe F test/attachmalloc.test cdb26c42850f04698377ccec05f5fa89d987837c F test/auth.test 973ae7274eae32c4453fbbcbd0ec2b80c5b1eeb3 F test/autoinc.test 395fbac8bc158d3599995c73bfb15c418a5429f0 -F test/autovacuum.test cf2719b17659f7a011202ad05905654cedf26023 +F test/autovacuum.test d2d0b2b86fd3b487d1e100fafcb03b1af6c23057 F test/autovacuum_crash.test 05a63b8805b20cfba7ace82856ce4ccdda075a31 F test/autovacuum_ioerr.test 9cf27275ca47b72e188a47c53b61b6d583a01d24 F test/autovacuum_ioerr2.test 2f8a3fb31f833fd0ca86ad4ad98913c73e807572 @@ -145,7 +145,7 @@ F test/enc2.test 76c13b8c00beaf95b15c152e95dab51292eb1f0d F test/enc3.test f6a5f0b7b7f3a88f030d3143729b87cd5c86d837 F test/expr.test 71b8cba7fe5c228147c93e530e098144565aaa46 F test/fkey1.test 153004438d51e6769fb1ce165f6313972d6263ce -F test/func.test 8f9165f0454b03f35c1f35668d516a96cbf4a41b +F test/func.test 89206eb4ec8bb2ba1853706470cc2b84147a8c78 F test/hook.test f8605cde4c77b2c6a4a73723bf6c507796a64dda F test/in.test cead6165aebbe0d451bb2263a307173acfeb6240 F test/index.test 51e01a0928b4b61228917ddd8c6c0e2466547f6f @@ -165,7 +165,7 @@ F test/journal1.test 36f2d1bb9bf03f790f43fbdb439e44c0657fab19 F test/lastinsert.test eaa89c6ee1f13062d87139fd32c1e56753d2fd89 F test/laststmtchanges.test 19a6d0c11f7a31dc45465b495f7b845a62cbec17 F test/like.test 145382e6a1f3d2edf266ca7d0236ab1b7c0ba66f -F test/limit.test 270b076f31c5c32f7187de5727e74da4de43e477 +F test/limit.test 39f084f4e5f11e0b984cb517b56867cbf88df156 F test/lock.test 9b7afcb24f53d24da502abb33daaad2cd6d44107 F test/lock2.test 59c3dd7d9b24d1bf7ec91b2d1541c37e97939d5f F test/lock3.test 615111293cf32aa2ed16d01c6611737651c96fb9 @@ -174,15 +174,15 @@ F test/malloc.test 666c77a878ce50f5c22b9211ed43e889cabb63a6 F test/malloc2.test 655b972372d2754a3f6c6ed54d7cfd18fde9bd32 F test/memdb.test 1860e060be810bf0775bc57408a5b7c4954bcaea F test/memleak.test df2b2b96e77f8ba159a332299535b1e5f18e49ac -F test/minmax.test 9429a06f1f93acf76fcacafd17160a4392e88526 -F test/misc1.test 4ca69ca2e2ef33c7a0b0fc8b324111e37a522d29 +F test/minmax.test 1d6f6cd00b0818423c52e71a5d684445b03e20d2 +F test/misc1.test c991617666991e11513e46cb646fd2e45ae68599 F test/misc2.test 5c699af2fede2694736a9f45aea7e2f052686e15 F test/misc3.test 7bd937e2c62bcc6be71939faf068d506467b1e03 -F test/misc4.test a4d1368bc598b03b3cf642d0bd22d51b28d6c156 +F test/misc4.test fbb81c1d520f34deea819a5d94d787d3d38dc35b F test/misc5.test 24bd03404039ec727028ac9cf7fd9066fd209ec9 F test/misuse.test 1c7fee3c4c0cb4008717ecccf5c72281fac0008e F test/notnull.test 7a08117a71e74b0321aaa937dbeb41a09d6eb1d0 -F test/null.test 69c62daf1630bf54c87bbc7ef2e22012e58d6da8 +F test/null.test 012fe5455f4fc3102490b4bad373a674e5741fdd F test/pager.test 1579e8f07291ae8e24db62ffade5c101c3e76597 F test/pager2.test 49c0f57c7da0b060f0486b85fdd074025caa694e F test/pager3.test 2323bf27fd5bd887b580247e5bce500ceee994b4 @@ -197,16 +197,16 @@ F test/rollback.test 94cd981ee3a627d9f6466f69dcf1f7dbfe695d7a F test/rowid.test 040a3bef06f970c45f5fcd14b2355f7f4d62f0cf F test/safety.test 907b64fee719554a3622853812af3886fddbbb4f F test/schema.test 21cbe7dac652f6d7eb058f3dec369bdbf46bbde6 -F test/select1.test ad700a2a1c325a23a7206ad4d189e33917de526f +F test/select1.test 480233d4f5a81d7d59a55e40d05084d97e57ecdf F test/select2.test f3c2678c3a9f3cf08ec4988a3845bda64be6d9e3 -F test/select3.test 44dccad96a1b9940bb8c6f982d4d218dcd262760 +F test/select3.test f8372ca3e99c4f2cf2e25498603c6b3bf5306613 F test/select4.test c239f516aa31f42f2ef7c6d7cd01105f08f934ca -F test/select5.test 1e2258ed2a660a2d0e2f44866712a2299f617a9e +F test/select5.test 2dcd382d1d416bf984cd3030ca9f386488a51ab1 F test/select6.test 21b72c56e7cbcefd063fdf9bc6c89342aedabccf F test/select7.test 1bf795b948c133a15a2a5e99d3270e652ec58ce6 F test/sort.test 0c33a8ae1c238377ad197387c3872175f40d3843 -F test/subquery.test ed4ecba1afacb586c86fad1cdb92756a48a90302 -F test/subselect.test 3f3f7a940dc3195c3139f4d530385cb54665d614 +F test/subquery.test e6de53332c0301b3cfa34edc3f3cd5fa1e859efd +F test/subselect.test 2d13fb7f450db3595adcdd24079a0dd1d2d6abc2 F test/sync.test d769caaec48456119316775e35e0fdee2fa852d7 F test/table.test d0e05ede3f6e5a8b79f8661ddcc4618cf7e69f8a F test/tableapi.test 6a66d58b37d46dc0f2b3c7d4bd2617d209399bd1 @@ -219,7 +219,7 @@ F test/threadtest2.c 97a830d53c24c42290501fdfba4a6e5bdd34748b F test/trace.test 9fd28695c463b90c2d32c387a432e01eb26e8ccf F test/trans.test 10506dc30305cfb8c4098359f7f6f64786f69c5e F test/trigger1.test 152aed5a1fa90709fe171f2ca501a6b7f7901479 -F test/trigger2.test f671b922c88f70c3cd2c6f03fe7c256ae7a52fc4 +F test/trigger2.test f85ee0db543c6303a23f7037cd48534dbb2d1796 F test/trigger3.test 9102fd3933db294dc654b5aee9edfe9e94f2b9e2 F test/trigger4.test 9615207f3746b1f3965113007869e45a895d2497 F test/trigger5.test 619391a3e9fc194081d22cefd830d811e7badf83 @@ -235,7 +235,7 @@ F test/vacuum.test 5d4857ae2afc9c20d0edb8acc58bdc8d630126a9 F test/vacuum2.test 5d77e98c458bcdbeecc6327de5107179ba1aa095 F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102 F test/view.test ce0f0ad39fa4a3572acffcf1e634850ee151aae0 -F test/where.test 1e9b990d64ca1d9175bcaa96e9f396e67c29ba07 +F test/where.test ce21f4910ef6a0c08f8172857baecefca20a3b0c F test/where2.test 503e2e2b6abe14c5c10222e72d08ef84c1bf1ffb F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b F tool/lemon.c c88936c67f6411608db8fa4254d254f509fa40f6 @@ -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 7283f7c29db4f622380b6a5cb745a4dc0c8e6a25 -R 2aaa5de130abcc544c107f6b4b8d52a3 +P cc2a61650ea0d4b2ef67e144424327362999526d +R 120f4a2c403c8caf23b54a6f849beb64 U drh -Z fefbf90fe1a173fa937df28e88a9560e +Z c87b2b0ad2e3bb024d1d63e6eeb11e3b diff --git a/manifest.uuid b/manifest.uuid index ea61e9abb..8c97a1315 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -cc2a61650ea0d4b2ef67e144424327362999526d
\ No newline at end of file +21adf4bd99e732650a1e8e9a1cc954126983a654
\ No newline at end of file diff --git a/src/func.c b/src/func.c index ceb5c8c39..e5395e799 100644 --- a/src/func.c +++ b/src/func.c @@ -16,7 +16,7 @@ ** sqliteRegisterBuildinFunctions() found at the bottom of the file. ** All other code has file scope. ** -** $Id: func.c,v 1.107 2005/09/06 20:36:49 drh Exp $ +** $Id: func.c,v 1.108 2005/09/08 10:37:01 drh Exp $ */ #include "sqliteInt.h" #include <ctype.h> @@ -819,6 +819,7 @@ typedef struct SumCtx SumCtx; struct SumCtx { double sum; /* Sum of terms */ int cnt; /* Number of elements summed */ + int isFloat; /* True if there has been any floating point value */ }; /* @@ -826,17 +827,26 @@ struct SumCtx { */ static void sumStep(sqlite3_context *context, int argc, sqlite3_value **argv){ SumCtx *p; + int type; if( argc<1 ) return; p = sqlite3_aggregate_context(context, sizeof(*p)); - if( p && SQLITE_NULL!=sqlite3_value_type(argv[0]) ){ + type = sqlite3_value_type(argv[0]); + if( p && type!=SQLITE_NULL ){ p->sum += sqlite3_value_double(argv[0]); p->cnt++; + if( type==SQLITE_FLOAT ) p->isFloat = 1; } } static void sumFinalize(sqlite3_context *context){ SumCtx *p; p = sqlite3_aggregate_context(context, 0); - sqlite3_result_double(context, p ? p->sum : 0.0); + if( p==0 ){ + sqlite3_result_int(context, 0); + }else if( p->isFloat ){ + sqlite3_result_double(context, p->sum); + }else{ + sqlite3_result_int64(context, (i64)p->sum); + } } static void avgFinalize(sqlite3_context *context){ SumCtx *p; diff --git a/test/autovacuum.test b/test/autovacuum.test index cc2211d78..f685ef8bb 100644 --- a/test/autovacuum.test +++ b/test/autovacuum.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this file is testing the SELECT statement. # -# $Id: autovacuum.test,v 1.17 2005/03/09 13:09:45 danielk1977 Exp $ +# $Id: autovacuum.test,v 1.18 2005/09/08 10:37:01 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -504,7 +504,7 @@ do_test autovacuum-4.1 { execsql { SELECT sum(a) FROM av1; } -} {5049.0} +} {5049} do_test autovacuum-4.2 { catchsql { CREATE UNIQUE INDEX av1_i ON av1(a); @@ -514,7 +514,7 @@ do_test autovacuum-4.3 { execsql { SELECT sum(a) FROM av1; } -} {5049.0} +} {5049} do_test autovacuum-4.4 { execsql { COMMIT; diff --git a/test/func.test b/test/func.test index 6d1fea192..d6cf6b258 100644 --- a/test/func.test +++ b/test/func.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this file is testing built-in functions. # -# $Id: func.test,v 1.37 2005/08/12 23:20:53 drh Exp $ +# $Id: func.test,v 1.38 2005/09/08 10:37:01 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -254,7 +254,7 @@ do_test func-8.1 { execsql { SELECT sum(a), count(a), round(avg(a),2), min(a), max(a), count(*) FROM t2; } -} {68236.0 3 22745.33 1 67890 5} +} {68236 3 22745.33 1 67890 5} do_test func-8.2 { execsql { SELECT max('z+'||a||'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP') FROM t2; @@ -495,6 +495,23 @@ do_test func-17.1 { } } {1 {Error %d with %s percents %p}} +# The SUM function should return integer results when all inputs are integer. +# +do_test func-18.1 { + execsql { + CREATE TABLE t5(x); + INSERT INTO t5 VALUES(1); + INSERT INTO t5 VALUES(-99); + INSERT INTO t5 VALUES(10000); + SELECT sum(x) FROM t5; + } +} {9902} +do_test func-18.2 { + execsql { + INSERT INTO t5 VALUES(0.0); + SELECT sum(x) FROM t5; + } +} {9902.0} finish_test diff --git a/test/limit.test b/test/limit.test index 77b4bc1f5..e6653167f 100644 --- a/test/limit.test +++ b/test/limit.test @@ -12,7 +12,7 @@ # focus of this file is testing the LIMIT ... OFFSET ... clause # of SELECT statements. # -# $Id: limit.test,v 1.24 2005/02/05 12:48:49 danielk1977 Exp $ +# $Id: limit.test,v 1.25 2005/09/08 10:37:01 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -184,7 +184,7 @@ do_test limit-5.5 { ORDER BY 1, 2 LIMIT 1000; SELECT count(*), sum(x), sum(y), min(x), max(x), min(y), max(y) FROM t5; } -} {1000 1528204.0 593161.0 0 3107 505 1005} +} {1000 1528204 593161 0 3107 505 1005} # There is some contraversy about whether LIMIT 0 should be the same as # no limit at all or if LIMIT 0 should result in zero output rows. diff --git a/test/minmax.test b/test/minmax.test index fd0ba4ec1..1e9e17f96 100644 --- a/test/minmax.test +++ b/test/minmax.test @@ -13,7 +13,7 @@ # aggregate min() and max() functions and which are handled as # as a special case. # -# $Id: minmax.test,v 1.16 2005/01/21 04:25:47 danielk1977 Exp $ +# $Id: minmax.test,v 1.17 2005/09/08 10:37:01 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -147,7 +147,7 @@ ifcapable {compound && subquery} { (SELECT null, y+1 FROM t1 UNION SELECT * FROM t1) GROUP BY y ORDER BY y; } - } {1 1.0 2 5.0 3 22.0 4 92.0 5 90.0 6 0.0} + } {1 1 2 5 3 22 4 92 5 90 6 0} do_test minmax-4.3 { execsql { SELECT y, count(x), count(*) FROM diff --git a/test/misc1.test b/test/misc1.test index 9d83f03f6..07fe13311 100644 --- a/test/misc1.test +++ b/test/misc1.test @@ -13,7 +13,7 @@ # This file implements tests for miscellanous features that were # left out of other test files. # -# $Id: misc1.test,v 1.37 2005/08/19 03:03:52 drh Exp $ +# $Id: misc1.test,v 1.38 2005/09/08 10:37:01 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -115,11 +115,11 @@ do_test misc1-2.1 { do_test misc1-2.2 { execsql {SELECT sum(one), two, four FROM agger GROUP BY two, four ORDER BY sum(one) desc} -} {8.0 two no 6.0 one yes 4.0 two yes 3.0 thr yes} +} {8 two no 6 one yes 4 two yes 3 thr yes} do_test misc1-2.3 { execsql {SELECT sum((one)), (two), (four) FROM agger GROUP BY (two), (four) ORDER BY sum(one) desc} -} {8.0 two no 6.0 one yes 4.0 two yes 3.0 thr yes} +} {8 two no 6 one yes 4 two yes 3 thr yes} # Here's a test for a bug found by Joel Lucsy. The code below # was causing an assertion failure. diff --git a/test/misc4.test b/test/misc4.test index 4f1272b26..9d7d79799 100644 --- a/test/misc4.test +++ b/test/misc4.test @@ -13,7 +13,7 @@ # This file implements tests for miscellanous features that were # left out of other test files. # -# $Id: misc4.test,v 1.19 2005/09/08 01:58:43 drh Exp $ +# $Id: misc4.test,v 1.20 2005/09/08 10:37:01 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -128,7 +128,7 @@ ifcapable subquery { from a, (select key,sum(period) from b group by key) as x where a.key=x.key; } - } {01 data01 01 3.0 +1 data+1 +1 7.0} + } {01 data01 01 3 +1 data+1 +1 7} # This test case tests the same property as misc4-4.1, but it is # a bit smaller which makes it easier to work with while debugging. diff --git a/test/null.test b/test/null.test index 0693f29ef..ba9c6f88e 100644 --- a/test/null.test +++ b/test/null.test @@ -100,7 +100,7 @@ do_test null-3.1 { select count(*), count(b), count(c), sum(b), sum(c), avg(b), avg(c), min(b), max(b) from t1; } -} {7 4 6 2.0 3.0 0.5 0.5 0 1} +} {7 4 6 2 3 0.5 0.5 0 1} # Check to see how WHERE clauses handle NULL values. A NULL value # is the same as UNKNOWN. The WHERE clause should only select those diff --git a/test/select1.test b/test/select1.test index 0f12ecf57..8a2a4f0b3 100644 --- a/test/select1.test +++ b/test/select1.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this file is testing the SELECT statement. # -# $Id: select1.test,v 1.42 2005/01/21 04:25:47 danielk1977 Exp $ +# $Id: select1.test,v 1.43 2005/09/08 10:37:01 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -199,7 +199,7 @@ do_test select1-2.14 { do_test select1-2.15 { set v [catch {execsql {SELECT Sum(f1) FROM test1}} msg] lappend v $msg -} {0 44.0} +} {0 44} do_test select1-2.16 { set v [catch {execsql {SELECT sum(f1,f2) FROM test1}} msg] lappend v $msg @@ -207,10 +207,10 @@ do_test select1-2.16 { do_test select1-2.17 { set v [catch {execsql {SELECT SUM(f1)+1 FROM test1}} msg] lappend v $msg -} {0 45.0} +} {0 45} do_test select1-2.17.1 { execsql {SELECT sum(a) FROM t3} -} {44.0} +} {44} do_test select1-2.18 { set v [catch {execsql {SELECT XYZZY(f1) FROM test1}} msg] lappend v $msg @@ -218,7 +218,7 @@ do_test select1-2.18 { do_test select1-2.19 { set v [catch {execsql {SELECT SUM(min(f1,f2)) FROM test1}} msg] lappend v $msg -} {0 44.0} +} {0 44} do_test select1-2.20 { set v [catch {execsql {SELECT SUM(min(f1)) FROM test1}} msg] lappend v $msg diff --git a/test/select3.test b/test/select3.test index f0be520a2..c0bd9b95b 100644 --- a/test/select3.test +++ b/test/select3.test @@ -12,7 +12,7 @@ # focus of this file is testing aggregate functions and the # GROUP BY and HAVING clauses of SELECT statements. # -# $Id: select3.test,v 1.13 2005/04/01 10:47:40 drh Exp $ +# $Id: select3.test,v 1.14 2005/09/08 10:37:01 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -44,7 +44,7 @@ do_test select3-1.2 { SELECT min(n),min(log),max(n),max(log),sum(n),sum(log),avg(n),avg(log) FROM t1 } -} {1 0 31 5 496.0 124.0 16.0 4.0} +} {1 0 31 5 496 124 16.0 4.0} do_test select3-1.3 { execsql {SELECT max(n)/avg(n), max(log)/avg(log) FROM t1} } {1.9375 1.25} diff --git a/test/select5.test b/test/select5.test index 57fe9ca54..01b737857 100644 --- a/test/select5.test +++ b/test/select5.test @@ -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.11 2005/09/07 22:48:16 drh Exp $ +# $Id: select5.test,v 1.12 2005/09/08 10:37:01 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -118,7 +118,7 @@ do_test select5-4.5 { execsql { SELECT sum(x) FROM t1 WHERE x>100 } -} {0.0} +} {0} # Some tests for queries with a GROUP BY clause but no aggregate functions. # diff --git a/test/subquery.test b/test/subquery.test index 394b7fdeb..f5c789672 100644 --- a/test/subquery.test +++ b/test/subquery.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this script is testing correlated subqueries # -# $Id: subquery.test,v 1.12 2005/08/25 12:45:04 drh Exp $ +# $Id: subquery.test,v 1.13 2005/09/08 10:37:01 drh Exp $ # set testdir [file dirname $argv0] @@ -112,7 +112,7 @@ do_test subquery-1.10.3 { execsql { SELECT * FROM (SELECT (SELECT sum(a) FROM t1)); } -} {16.0} +} {16} do_test subquery-1.10.4 { execsql { CREATE TABLE t5 (val int, period text PRIMARY KEY); @@ -134,7 +134,7 @@ do_test subquery-1.10.4 { FROM t5 a where a.period between '2002-1' and '2002-4') WHERE vsum < 45 ; } -} {2002-2 30.0 2002-3 25.0 2002-4 15.0} +} {2002-2 30 2002-3 25 2002-4 15} do_test subquery-1.10.5 { execsql { SELECT "a.period", vsum from @@ -143,7 +143,7 @@ do_test subquery-1.10.5 { FROM t5 a where a.period between '2002-1' and '2002-4') WHERE vsum < 45 ; } -} {2002-2 30.0 2002-3 25.0 2002-4 15.0} +} {2002-2 30 2002-3 25 2002-4 15} do_test subquery-1.10.6 { execsql { DROP TABLE t5; diff --git a/test/subselect.test b/test/subselect.test index 58f68b116..20d401c6f 100644 --- a/test/subselect.test +++ b/test/subselect.test @@ -12,7 +12,7 @@ # focus of this file is testing SELECT statements that are part of # expressions. # -# $Id: subselect.test,v 1.12 2005/01/21 03:12:16 danielk1977 Exp $ +# $Id: subselect.test,v 1.13 2005/09/08 10:37:01 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -132,12 +132,12 @@ do_test subselect-3.2 { execsql { SELECT sum(x) FROM (SELECT x FROM t3 ORDER BY x LIMIT 2); } -} {3.0} +} {3} do_test subselect-3.3 { execsql { SELECT sum(x) FROM (SELECT x FROM t3 ORDER BY x DESC LIMIT 2); } -} {11.0} +} {11} do_test subselect-3.4 { execsql { SELECT (SELECT x FROM t3 ORDER BY x); diff --git a/test/trigger2.test b/test/trigger2.test index 55f7bb9c2..a15d4cc9e 100644 --- a/test/trigger2.test +++ b/test/trigger2.test @@ -196,8 +196,8 @@ ifcapable subquery { SELECT * FROM rlog; } - } [list 1 0 0 0.0 0.0 5 6 \ - 2 0 0 5.0 6.0 5 6 ] + } [list 1 0 0 0 0 5 6 \ + 2 0 0 5 6 5 6 ] integrity_check trigger2-1.$ii.4 } diff --git a/test/where.test b/test/where.test index c56cec908..b946684fa 100644 --- a/test/where.test +++ b/test/where.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this file is testing the use of indices in WHERE clases. # -# $Id: where.test,v 1.35 2005/09/01 17:47:52 drh Exp $ +# $Id: where.test,v 1.36 2005/09/08 10:37:02 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -443,7 +443,7 @@ do_test where-6.1 { INSERT INTO t3 SELECT w, 101-w, y FROM t1; SELECT count(*), sum(a), sum(b), sum(c) FROM t3; } -} {100 5050.0 5050.0 348550.0} +} {100 5050 5050 348550} do_test where-6.2 { cksort { SELECT * FROM t3 ORDER BY a LIMIT 3 |