From: drh Date: Thu, 4 Jan 2007 01:20:28 +0000 (+0000) Subject: Fix for ticket #2141. (CVS 3552) X-Git-Tag: version-3.6.10~2616 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=89c69d00bde9be8f7b2265c859ec1a08a9e2e0f1;p=thirdparty%2Fsqlite.git Fix for ticket #2141. (CVS 3552) FossilOrigin-Name: 70f5f3b85f30bbec0ddc59ba364e1229c09ed636 --- diff --git a/manifest b/manifest index 396e79887a..b97a03434e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sa\scomment\sto\svdbe.c\sto\sexplain\sthe\suse\sof\san\suninitialized\svariable.\s(CVS\s3551) -D 2007-01-04T01:20:11 +C Fix\sfor\sticket\s#2141.\s(CVS\s3552) +D 2007-01-04T01:20:29 F Makefile.in 63a71177ed4355c829229affe11167bd28c85884 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -65,7 +65,7 @@ F src/complete.c 7d1a44be8f37de125fcafd3d3a018690b3799675 F src/date.c 9602457c49210f77f860d1919a8249a3118cd43f F src/delete.c 804384761144fe1a5035b99f4bd7d706976831bd F src/experimental.c 1b2d1a6cd62ecc39610e97670332ca073c50792b -F src/expr.c 82603dc2882797734882507ed95dfcb7f7c583e3 +F src/expr.c 3d2cf15fd9aa6b60b67f45504782cce72cd07963 F src/func.c af537156dfeb91dbac8ffed4db6c4fa1a3164cc9 F src/hash.c 449f3d6620193aa557f5d86cbc5cc6b87702b185 F src/hash.h 1b3f7e2609141fd571f62199fc38687d262e9564 @@ -318,6 +318,7 @@ F test/tkt1567.test 18023cc3626a365f0118e17b66decedec93b1a6f F test/tkt1644.test 80b6a2bb17885f3cf1cb886d97cdad13232bb869 F test/tkt1667.test ef52c857940755ea5eab24d68f808826e7dcdc94 F test/tkt1873.test 7159a1c1bf627bbb03f11362e4ad4de11d6ff316 +F test/tkt2141.test 78fb8ea2e7e38f7e5b3e649ca9426928056ef55c F test/trace.test 75ffc1b992c780d054748a656e3e7fd674f18567 F test/trans.test 06bff0246886858793fca3748721936e2f65e3df F test/trigger1.test 2c79e2bf76350811e362814e98779c120b6a9421 @@ -423,7 +424,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 -P 70a862702d6dfcfe73bdeef8f0502c6c50e32a3a -R 94e85cc99486398830120433fc02687d +P 1773eb7badf105b0e23316d4236903049c354c71 +R 2681a104df3f1df417aa976e25f15965 U drh -Z c787bd483bb44df57843a66caa4432ea +Z 9485777b9d7913cf365025cd24d25512 diff --git a/manifest.uuid b/manifest.uuid index a8ebd68569..7c0ac457f9 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1773eb7badf105b0e23316d4236903049c354c71 \ No newline at end of file +70f5f3b85f30bbec0ddc59ba364e1229c09ed636 \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index 1d5e186a0c..aa70bdd9c1 100644 --- a/src/expr.c +++ b/src/expr.c @@ -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.270 2006/12/16 16:25:15 drh Exp $ +** $Id: expr.c,v 1.271 2007/01/04 01:20:29 drh Exp $ */ #include "sqliteInt.h" #include @@ -2208,6 +2208,7 @@ static int analyzeAggregate(void *pArg, Expr *pExpr){ switch( pExpr->op ){ + case TK_AGG_COLUMN: case TK_COLUMN: { /* Check to see if the column is in one of the tables in the FROM ** clause of the aggregate query */ diff --git a/test/tkt2141.test b/test/tkt2141.test new file mode 100644 index 0000000000..f572817a35 --- /dev/null +++ b/test/tkt2141.test @@ -0,0 +1,57 @@ +# 2007 January 03 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# This file implements regression tests for SQLite library. +# +# This file implements tests to verify that ticket #2141 has been +# fixed. +# +# +# $Id: tkt2141.test,v 1.1 2007/01/04 01:20:29 drh Exp $ + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + + +do_test tkt2141-1.1 { + execsql { + CREATE TABLE tab1 (t1_id integer PRIMARY KEY, t1_desc); + INSERT INTO tab1 VALUES(1,'rec 1 tab 1'); + CREATE TABLE tab2 (t2_id integer PRIMARY KEY, t2_id_t1, t2_desc); + INSERT INTO tab2 VALUES(1,1,'rec 1 tab 2'); + CREATE TABLE tab3 (t3_id integer PRIMARY KEY, t3_id_t2, t3_desc); + INSERT INTO tab3 VALUES(1,1,'aa'); + SELECT * + FROM tab1 t1 LEFT JOIN tab2 t2 ON t1.t1_id = t2.t2_id_t1 + WHERE t2.t2_id IN + (SELECT t2_id FROM tab2, tab3 ON t2_id = t3_id_t2 + WHERE t3_id IN (1,2) GROUP BY t2_id); + } +} {1 {rec 1 tab 1} 1 1 {rec 1 tab 2}} +do_test tkt2141-1.2 { + execsql { + SELECT * + FROM tab1 t1 LEFT JOIN tab2 t2 ON t1.t1_id = t2.t2_id_t1 + WHERE t2.t2_id IN + (SELECT t2_id FROM tab2, tab3 ON t2_id = t3_id_t2 + WHERE t3_id IN (1,2)); + } +} {1 {rec 1 tab 1} 1 1 {rec 1 tab 2}} +do_test tkt2141-1.3 { + execsql { + SELECT * + FROM tab1 t1 LEFT JOIN tab2 t2 + WHERE t2.t2_id IN + (SELECT t2_id FROM tab2, tab3 ON t2_id = t3_id_t2 + WHERE t3_id IN (1,2)); + } +} {1 {rec 1 tab 1} 1 1 {rec 1 tab 2}} + +finish_test