]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Apply (1679) to version 3. Ticket #777. (CVS 1680)
authordanielk1977 <danielk1977@noemail.net>
Thu, 24 Jun 2004 00:20:04 +0000 (00:20 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Thu, 24 Jun 2004 00:20:04 +0000 (00:20 +0000)
FossilOrigin-Name: 0a26b9158095f0995fce2f0ccdfb383ab26c76a5

manifest
manifest.uuid
src/func.c
test/func.test
test/minmax.test
test/null.test
test/select1.test

index 9fc90af2071d0aafd09dad8da071a4282ec3dbbd..b5f0aedc78676bc77afebaf427d1463abf45aa51 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Improve\stest\scoverage\sof\sutf.c.\s(CVS\s1678)
-D 2004-06-23T13:46:32
+C Apply\s(1679)\sto\sversion\s3.\s\sTicket\s#777.\s(CVS\s1680)
+D 2004-06-24T00:20:05
 F Makefile.in 0a3d7aaefa50717bd550b0cf568a51072c4c103c
 F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -33,7 +33,7 @@ F src/date.c b3e8b2bef1e3f2ce24e5b057203036defb18c3f1
 F src/delete.c e81545e546f6bc87d7508a93a09ca70695265af3
 F src/encode.c a876af473d1d636faa3dca51c7571f2e007eea37
 F src/expr.c db0e1fdcf967f6db6b2d4503cdbdbccde8c61e52
-F src/func.c 3d32878eeb4c6a9977c72ec19984d329b6954c7e
+F src/func.c c38c8bcaf118204baf343711b9e7f5bf804ed9c3
 F src/hash.c 440c2f8cb373ee1b4e13a0988489c7cd95d55b6f
 F src/hash.h 762d95f1e567664d1eafc1687de755626be962fb
 F src/insert.c d99ffe87e1e1397f4233afcd06841d52d6b17b18
@@ -113,7 +113,7 @@ F test/enc2.test 8a3b62254292c8ed6bb0671fcecb032b6fcbc356
 F test/enc3.test 315f302ed9a6042be76710eb6aa70e4551e9aa73
 F test/expr.test b4e945265c4c697bf5213b72558914ba10a989cc
 F test/fkey1.test d65c824459916249bee501532d6154ddab0b5db7
-F test/func.test 95eba35f06e56e66fa40726957ce103b4e6ffe73
+F test/func.test db369afc9e77c4b40863e55497c8f0e449a43e79
 F test/hook.test c4102c672d67f8fb60ea459842805abcba69a747
 F test/in.test b92a2df9162e1cbd33c6449a29a05e6955b1741a
 F test/index.test b6941dd532815f278042b85f79b1a6dc16c4d729
@@ -132,13 +132,13 @@ F test/main.test e8c4d9ca6d1e5f5e55e6550d31aec488883b2ed9
 F test/malloc.test 082206002cb3162fbbed1c3dd3794a06cee86652
 F test/memdb.test b8a13fa79f006bd087bbcf135ce8eb62056a6027
 F test/memleak.test eb3ca96a2e818788712732a42cc410635a712593
-F test/minmax.test 9dcf52f713b1b9e61d0a88a51eb8bb2e3c52d0ab
+F test/minmax.test 3f87d1d49f7e9aa9ae80d35c47a1f5b034557899
 F test/misc1.test a8eb48d38f7a64e75314a2946db68d2b77901b7d
 F test/misc2.test 703734f5817215ca54e364833b3bf5ff36fcc21e
 F test/misc3.test eb488314990bfc0959221a1acc465013238bf168
 F test/misuse.test 97456c4fa78be0c3151f41aa05c763b9f6b11f81
 F test/notnull.test 7a08117a71e74b0321aaa937dbeb41a09d6eb1d0
-F test/null.test c14d0f4739f21e929b8115b72bf0c765b6bb1721
+F test/null.test 64730a1c32955e5cc510b7632fed6b9929a4029a
 F test/pager.test 059cc5c58d3b5a851343dff8c56cf7286425d03a
 F test/pager2.test 55469c7c1c1a54d6b32d7b3cc99001e90101a1ce
 F test/pragma.test e09ac12edbdac81d21ca88084fef376c7667f5b0
@@ -147,7 +147,7 @@ F test/progress.test 7542a6ac7894a1b7730c1f9a27f3f8b9388a4d25 x
 F test/quick.test 4c0b3eabe2e0e606622d63d7d61ef6efb3ce156b
 F test/quote.test 08f23385c685d3dc7914ec760d492cacea7f6e3d
 F test/rowid.test 8845b4861341ef23f94e51f27702335d9c5dcd31
-F test/select1.test 2f161f9cdf9fb577336bc8c930edade538567123
+F test/select1.test 813a270ac7996b31ff228e8109cd2d1e8c3fa255
 F test/select2.test 91a2225926039b0d1687840735c284dbbf89f0bc
 F test/select3.test ab2e583154ee230fa4b46b06512775a38cd9d8b0
 F test/select4.test 86e72fc3b07de4fe11439aa419e37db3c49467e2
@@ -229,7 +229,7 @@ F www/tclsqlite.tcl 19191cf2a1010eaeff74c51d83fd5f5a4d899075
 F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
 F www/version3.tcl 563ba3ac02f64da27ab17f3edbe8e56bfd0293fb
 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
-P f31c84a64f53cf2e75a5e988fbb6ad82537f2403
-R f27d37e6f5bb430f35de9b0eadf438e6
+P 53c553c760a84e213c2277588bcc292892c2b0ce
+R 8f108e97dd623d6ab372f3a14356bdf0
 U danielk1977
-Z 8f088a4eb584d07b7963f42469cbadf6
+Z 2dd152c9007a76ff0b7936eed63977ea
index 6f379fc5b149e75cd61363cc6e87802c2549199a..7bc7b0ce01d61025bbe36ec885c754c0f9e2a3fa 100644 (file)
@@ -1 +1 @@
-53c553c760a84e213c2277588bcc292892c2b0ce
\ No newline at end of file
+0a26b9158095f0995fce2f0ccdfb383ab26c76a5
\ No newline at end of file
index 6c22ece385f3c5e1c13f094bd9cfbde833409004..e8cea2bbde0def1807fcb6b84637b3ef49a5c7fe 100644 (file)
@@ -16,7 +16,7 @@
 ** sqliteRegisterBuildinFunctions() found at the bottom of the file.
 ** All other code has file scope.
 **
-** $Id: func.c,v 1.75 2004/06/21 06:50:28 danielk1977 Exp $
+** $Id: func.c,v 1.76 2004/06/24 00:20:05 danielk1977 Exp $
 */
 #include <ctype.h>
 #include <math.h>
@@ -971,8 +971,8 @@ static void minmaxStep(sqlite3_context *context, int argc, sqlite3_value **argv)
   int cmp = 0;
   Mem *pArg  = (Mem *)argv[0];
   Mem *pBest = (Mem *)sqlite3_aggregate_context(context, sizeof(*pBest));
+  if( !pBest ) return;
 
-  if( !pBest || SQLITE_NULL==sqlite3_value_type(argv[0]) ) return;
   if( pBest->flags ){
     CollSeq *pColl = sqlite3GetFuncCollSeq(context);
     /* This step function is used for both the min() and max() aggregates,
index 590aaa8cc41c3a1fe67538c9160685672652265e..b80cc59a7927531c8aa503423a8b27c72fd776b6 100644 (file)
@@ -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.25 2004/06/23 01:05:27 danielk1977 Exp $
+# $Id: func.test,v 1.26 2004/06/24 00:20:05 danielk1977 Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -251,7 +251,7 @@ do_test func-8.1 {
   execsql {
     SELECT sum(a), count(a), round(avg(a),2), min(a), max(a), count(*) FROM t2;
   }
-} {68236 3 22745.33 1 67890 5}
+} {68236 3 22745.33 {} 67890 5}
 do_test func-8.2 {
   execsql {
     SELECT max('z+'||a||'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP') FROM t2;
@@ -262,7 +262,12 @@ do_test func-8.3 {
     CREATE TEMP TABLE t3 AS SELECT a FROM t2 ORDER BY a DESC;
     SELECT min('z+'||a||'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP') FROM t3;
   }
-} {z+1abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP}
+} {{}}
+do_test func-8.4 {
+  execsql {
+    SELECT max('z+'||a||'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP') FROM t3;
+  }
+} {z+67890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP}
 
 # How do you test the random() function in a meaningful, deterministic way?
 #
index 5517ad99e6b3c8481dbb3711cccfdbeecff95f6d..3a32f76c7aea27c8d72841101aea0b5d61c80c77 100644 (file)
@@ -13,7 +13,7 @@
 # aggregate min() and max() functions and which are handled as
 # as a special case.
 #
-# $Id: minmax.test,v 1.9 2004/03/13 14:00:37 drh Exp $
+# $Id: minmax.test,v 1.10 2004/06/24 00:20:05 danielk1977 Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -127,7 +127,7 @@ do_test minmax-4.1 {
     SELECT coalesce(min(x+0),-1), coalesce(max(x+0),-1) FROM
       (SELECT * FROM t1 UNION SELECT NULL as 'x', NULL as 'y')
   }
-} {1 20}
+} {-1 20}
 do_test minmax-4.2 {
   execsql {
     SELECT y, sum(x) FROM
@@ -276,4 +276,34 @@ do_test minmax-9.2 {
   }
 } {{}}
 
+# If there is a NULL in an aggregate max(), ignore it.  If a NULL
+# occurs in an aggregate min(), then the result will be NULL because
+# NULL compares less than all other values.
+#
+do_test minmax-10.1 {
+  execsql {
+    CREATE TABLE t6(x);
+    INSERT INTO t6 VALUES(1);
+    INSERT INTO t6 VALUES(2);
+    INSERT INTO t6 VALUES(NULL);
+    SELECT coalesce(min(x),-1) FROM t6;
+  }
+} {-1}
+do_test minmax-10.2 {
+  execsql {
+    SELECT max(x) FROM t6;
+  }
+} {2}
+do_test minmax-10.3 {
+  execsql {
+    CREATE INDEX i6 ON t6(x);
+    SELECT coalesce(min(x),-1) FROM t6;
+  }
+} {-1}
+do_test minmax-10.4 {
+  execsql {
+    SELECT max(x) FROM t6;
+  }
+} {2}
+
 finish_test
index 9705921715071935e4837ece8c1393e0dfa7f1b2..fdb8b17a2a404b48b3e6a913b4ff94d10d2c9e58 100644 (file)
@@ -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 3 0.5 0.5 0 1}
+} {7 4 6 2 3 0.5 0.5 {} 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
index 3e647b32d1cadc7faaa2b3edee4d46dd44643b99..c534acce23941ced0422c9efa637504c8b8e1f86 100644 (file)
@@ -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.32 2004/05/28 11:37:29 danielk1977 Exp $
+# $Id: select1.test,v 1.33 2004/06/24 00:20:05 danielk1977 Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -159,7 +159,7 @@ do_test select1-2.8 {
 } {0 {11 33}}
 do_test select1-2.8.1 {
   execsql {SELECT coalesce(min(a),'xyzzy') FROM t3}
-} {11}
+} {xyzzy}
 do_test select1-2.8.2 {
   execsql {SELECT min(coalesce(a,'xyzzy')) FROM t3}
 } {11}