diff options
author | drh <drh@noemail.net> | 2005-11-16 12:53:15 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2005-11-16 12:53:15 +0000 |
commit | 7e56e71125781100c59b13a1c4e88ebc97ff2a78 (patch) | |
tree | e1c40130641860c20b0ff08e80594baa6110d28f /src | |
parent | ed2df7fb6882c2633ff3c148e6ed388007fe314f (diff) | |
download | sqlite-7e56e71125781100c59b13a1c4e88ebc97ff2a78.tar.gz sqlite-7e56e71125781100c59b13a1c4e88ebc97ff2a78.zip |
Do not allow aggregate functions in a WHERE clause. Ticket #1514. (CVS 2769)
FossilOrigin-Name: bb866ed880c33ec9ce6ded8ebdbb459fedf9c257
Diffstat (limited to 'src')
-rw-r--r-- | src/expr.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/expr.c b/src/expr.c index 3fce58ca6..0a31ab47b 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.237 2005/11/14 22:29:05 drh Exp $ +** $Id: expr.c,v 1.238 2005/11/16 12:53:15 drh Exp $ */ #include "sqliteInt.h" #include <ctype.h> @@ -1650,7 +1650,12 @@ void sqlite3ExprCode(Parse *pParse, Expr *pExpr){ } case TK_AGG_FUNCTION: { AggInfo *pInfo = pExpr->pAggInfo; - sqlite3VdbeAddOp(v, OP_MemLoad, pInfo->aFunc[pExpr->iAgg].iMem, 0); + if( pInfo==0 ){ + sqlite3ErrorMsg(pParse, "misuse of aggregate: %T", + &pExpr->span); + }else{ + sqlite3VdbeAddOp(v, OP_MemLoad, pInfo->aFunc[pExpr->iAgg].iMem, 0); + } break; } case TK_CONST_FUNC: |