]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Bug fix in the new COUNT(DISTINCT) logic. Ticket #1420. (CVS 2689)
authordrh <drh@noemail.net>
Mon, 12 Sep 2005 23:03:16 +0000 (23:03 +0000)
committerdrh <drh@noemail.net>
Mon, 12 Sep 2005 23:03:16 +0000 (23:03 +0000)
FossilOrigin-Name: 37116550d33d8e3bdc15cd9998b9d2b97dec312b

manifest
manifest.uuid
src/select.c
test/distinctagg.test

index e15c42e7aa3e8bb9136875e55af6ae9e64d8b48e..523a97d5a5658e397d540d86403140f0e933d798 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C COUNT(DISTINCT\sx)\sis\snow\sfully\sfunctional,\sthough\sit\scould\sbenefit\sfrom\nadditional\stesting.\s(CVS\s2688)
-D 2005-09-11T11:56:28
+C Bug\sfix\sin\sthe\snew\sCOUNT(DISTINCT)\slogic.\s\sTicket\s#1420.\s(CVS\s2689)
+D 2005-09-12T23:03:17
 F Makefile.in 12784cdce5ffc8dfb707300c34e4f1eb3b8a14f1
 F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -63,7 +63,7 @@ F src/pragma.c 69413fbdc0c6aaa493a776ea52c1b3e6cf35dfb2
 F src/prepare.c fc098db25d2a121affb08686cf04833fd50452d4
 F src/printf.c c01e9ad473d79463fb1f483b1eca5c3cbed2a4e5
 F src/random.c 90adff4e73a3b249eb4f1fc2a6ff9cf78c7233a4
-F src/select.c 67653a6fe6879be49e90ea05957c9f517978e215
+F src/select.c 9ef1dddd436e1ea86a6bf64ae0ed71bf4a0b894f
 F src/shell.c 3596c1e559b82663057940d19ba533ad421c7dd3
 F src/sqlite.h.in 461b2535550cf77aedfd44385da11ef7d63e57a2
 F src/sqliteInt.h 0d38d50ebe15a16a1253c9a6f9ce4ad188e097fe
@@ -140,7 +140,7 @@ F test/delete.test 33e1670049364fc3604217a6c2eda042a47115ab
 F test/delete2.test e382b6a97787197eb8b93dd4ccd37797c3725ea3
 F test/delete3.test 555e84a00a99230b7d049d477a324a631126a6ab
 F test/diskfull.test d828d72adfc9e2d1a194d25996718c1989152cf9
-F test/distinctagg.test 08ba294140bde69f24f6b2e0e3f5b181953fa5b6
+F test/distinctagg.test 2b89d1c5220d966a30ba4b40430338669301188b
 F test/enc.test 7a03417a1051fe8bc6c7641cf4c8c3f7e0066d52
 F test/enc2.test 76c13b8c00beaf95b15c152e95dab51292eb1f0d
 F test/enc3.test f6a5f0b7b7f3a88f030d3143729b87cd5c86d837
@@ -307,7 +307,7 @@ F www/tclsqlite.tcl 3df553505b6efcad08f91e9b975deb2e6c9bb955
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P 3f191cf497e5798a8620ebc5a85e34187f58371c
-R 8acc7ab8193e40ac6db21da4fc146b2f
+P 2f397bd8142ec5e8f7238127012d14fdb558d918
+R 618d60bfccb929a4f836778c62dd17fb
 U drh
-Z 09cbf8e6da3db4ebea040b8fc4deab31
+Z 26fb548fc8bf7d7e82c28eabe1666997
index 162f265d087c626eb2e1b471c0360e882614a1e5..0424adf2c0989135bbd55c1a503f43a4a6a48511 100644 (file)
@@ -1 +1 @@
-2f397bd8142ec5e8f7238127012d14fdb558d918
\ No newline at end of file
+37116550d33d8e3bdc15cd9998b9d2b97dec312b
\ No newline at end of file
index f1569352723189f26a776a08a3d90369a5d3110a..8c02215a3358fa0162b6ef9dbf75423421efaae6 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.268 2005/09/11 11:56:28 drh Exp $
+** $Id: select.c,v 1.269 2005/09/12 23:03:17 drh Exp $
 */
 #include "sqliteInt.h"
 
@@ -2490,7 +2490,7 @@ static void updateAccumulator(Parse *pParse, AggInfo *pAggInfo){
     if( pF->iDistinct>=0 ){
       addrNext = sqlite3VdbeMakeLabel(v);
       assert( nArg==1 );
-      codeDistinct(v, pF->iDistinct, addrNext, 1, 1);
+      codeDistinct(v, pF->iDistinct, addrNext, 1, 2);
     }
     if( pF->pFunc->needCollSeq ){
       CollSeq *pColl = 0;
index ebd3edd1f5e692a4b96d9b490927317bb9c2bde0..b2191ea43a43062eefddd748d441d80d8eeeb1ba 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.  The
 # focus of this script is the DISTINCT modifier on aggregate functions.
 #
-# $Id: distinctagg.test,v 1.1 2005/09/11 11:56:28 drh Exp $
+# $Id: distinctagg.test,v 1.2 2005/09/12 23:03:17 drh Exp $
 
 
 set testdir [file dirname $argv0]
@@ -34,6 +34,19 @@ do_test distinctagg-1.2 {
     SELECT b, count(distinct c) FROM t1 GROUP BY b ORDER BY b
   }
 } {2 1 3 2}
+do_test distinctagg-1.3 {
+  execsql {
+    INSERT INTO t1 SELECT a+1, b+3, c+5 FROM t1;
+    INSERT INTO t1 SELECT a+2, b+6, c+10 FROM t1;
+    INSERT INTO t1 SELECT a+4, b+12, c+20 FROM t1;
+    SELECT count(*), count(distinct a), count(distinct b) FROM t1
+  }
+} {24 8 16}
+do_test distinctagg-1.4 {
+  execsql {
+    SELECT a, count(distinct c) FROM t1 GROUP BY a ORDER BY a
+  }
+} {1 3 2 3 3 3 4 3 5 3 6 3 7 3 8 3}
 
 do_test distinctagg-2.1 {
   catchsql {