When the left-hand side of an IN operator is constant and the right-hand
side is a SELECT, recognize that the IN operator is not constant. Ticket #1380. (CVS 2624) FossilOrigin-Name: fc9e04609b6968fc5039a6f9f808aac681f4fc41
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
C Fix\sthe\s--enable-threadsafe\soption\sto\sthe\sconfigure\sscript.\s\sTicket\s#1378.\s(CVS\s2623)
|
||||
D 2005-08-24T18:04:52
|
||||
C When\sthe\sleft-hand\sside\sof\san\sIN\soperator\sis\sconstant\sand\sthe\sright-hand\nside\sis\sa\sSELECT,\srecognize\sthat\sthe\sIN\soperator\sis\snot\sconstant.\nTicket\s#1380.\s(CVS\s2624)
|
||||
D 2005-08-25T12:45:04
|
||||
F Makefile.in 87717916c787099d5a9a64f7a2acc188b4bbcadd
|
||||
F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7
|
||||
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
||||
@@ -40,7 +40,7 @@ F src/complete.c 4de937dfdd4c79a501772ab2035b26082f337a79
|
||||
F src/date.c 7444b0900a28da77e57e3337a636873cff0ae940
|
||||
F src/delete.c be1fc25c9e109cd8cbab42a43ee696263da7c04b
|
||||
F src/experimental.c 50c1e3b34f752f4ac10c36f287db095c2b61766d
|
||||
F src/expr.c e05fa8448a6417ef996c48c66397a05f58594e14
|
||||
F src/expr.c 1916cb22c585e1aa0d1e25a8efe7497004b6ae32
|
||||
F src/func.c 5b12db87f0bc7d978eaf87c7a348ada5d1934da4
|
||||
F src/hash.c 2b1b13f7400e179631c83a1be0c664608c8f021f
|
||||
F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84
|
||||
@@ -205,7 +205,7 @@ F test/select5.test ae1b5ee2485c5fdc610207a391cfdc23e59c7834
|
||||
F test/select6.test 6559d16ad16edb7d6864f7e74a3d204d0af72486
|
||||
F test/select7.test 1bf795b948c133a15a2a5e99d3270e652ec58ce6
|
||||
F test/sort.test 3b871d6e032f0a6c84d9f3d2d4b226e8fda97de0
|
||||
F test/subquery.test 0df3de0dbb65165b96ebe895550f1549d5439856
|
||||
F test/subquery.test ed4ecba1afacb586c86fad1cdb92756a48a90302
|
||||
F test/subselect.test 3f3f7a940dc3195c3139f4d530385cb54665d614
|
||||
F test/table.test d0e05ede3f6e5a8b79f8661ddcc4618cf7e69f8a
|
||||
F test/tableapi.test 6a66d58b37d46dc0f2b3c7d4bd2617d209399bd1
|
||||
@@ -298,7 +298,7 @@ F www/tclsqlite.tcl 3df553505b6efcad08f91e9b975deb2e6c9bb955
|
||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
|
||||
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
|
||||
P 881dcf5fb16997830ff347d2eb2610784b415f25
|
||||
R 939024975362728b01087b80f2fa0a24
|
||||
P 76ec0b3d3a6cc82965e4f993375780b954c53dd1
|
||||
R 52db1856673c57f1c9eec51f995f0a47
|
||||
U drh
|
||||
Z 0f48b7d406ced2895a04bb83a892dae0
|
||||
Z 2cab6797642524cf30db4c5e3889225c
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
76ec0b3d3a6cc82965e4f993375780b954c53dd1
|
||||
fc9e04609b6968fc5039a6f9f808aac681f4fc41
|
||||
+8
-1
@@ -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.220 2005/08/24 16:54:05 drh Exp $
|
||||
** $Id: expr.c,v 1.221 2005/08/25 12:45:04 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <ctype.h>
|
||||
@@ -624,6 +624,8 @@ void sqlite3ExprListDelete(ExprList *pList){
|
||||
**
|
||||
** The return value from this routine is 1 to abandon the tree walk
|
||||
** and 0 to continue.
|
||||
**
|
||||
** NOTICE: This routine does *not* descend into subqueries.
|
||||
*/
|
||||
static int walkExprList(ExprList *, int (*)(void *, Expr*), void *);
|
||||
static int walkExprTree(Expr *pExpr, int (*xFunc)(void*,Expr*), void *pArg){
|
||||
@@ -696,6 +698,11 @@ static int exprNodeIsConstant(void *pArg, Expr *pExpr){
|
||||
#endif
|
||||
*((int*)pArg) = 0;
|
||||
return 2;
|
||||
case TK_IN:
|
||||
if( pExpr->pSelect ){
|
||||
*((int*)pArg) = 0;
|
||||
return 2;
|
||||
}
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
+24
-1
@@ -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.11 2005/07/21 03:48:20 drh Exp $
|
||||
# $Id: subquery.test,v 1.12 2005/08/25 12:45:04 drh Exp $
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
@@ -386,6 +386,29 @@ do_test subquery-5.2 {
|
||||
} {1}
|
||||
|
||||
|
||||
# Ticket #1380. Make sure correlated subqueries on an IN clause work
|
||||
# correctly when the left-hand side of the IN operator is constant.
|
||||
#
|
||||
do_test subquery-6.1 {
|
||||
set callcnt 0
|
||||
execsql {
|
||||
SELECT x FROM t4 WHERE 1 IN (SELECT callcnt(count(*)) FROM t5 WHERE a=y)
|
||||
}
|
||||
} {one two three four}
|
||||
do_test subquery-6.2 {
|
||||
set callcnt
|
||||
} {4}
|
||||
do_test subquery-6.3 {
|
||||
set callcnt 0
|
||||
execsql {
|
||||
SELECT x FROM t4 WHERE 1 IN (SELECT callcnt(count(*)) FROM t5 WHERE a=1)
|
||||
}
|
||||
} {one two three four}
|
||||
do_test subquery-6.4 {
|
||||
set callcnt
|
||||
} {1}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user