diff options
author | drh <drh@noemail.net> | 2018-07-27 23:33:16 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2018-07-27 23:33:16 +0000 |
commit | 954733b3864f2659ae839dc5009a5e66469bae2c (patch) | |
tree | 9b11cdb360b51085ae22c04363188396113001da /src/expr.c | |
parent | cf8e0861a29f5d6cdfb1974c2d029de04a0bb1ac (diff) | |
download | sqlite-954733b3864f2659ae839dc5009a5e66469bae2c.tar.gz sqlite-954733b3864f2659ae839dc5009a5e66469bae2c.zip |
Improvements to the parser to increase coverage. Fix the parser so that
at least one expresssion is required after PARTITION BY and within the
list of expressions on VALUES().
FossilOrigin-Name: 02204f8b246c868846f39bd44f2e3bc0fab0275aa09ef3a0e5a8e3d58f484ca8
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/expr.c b/src/expr.c index 776706105..986b4f9aa 100644 --- a/src/expr.c +++ b/src/expr.c @@ -941,7 +941,12 @@ Expr *sqlite3ExprAnd(sqlite3 *db, Expr *pLeft, Expr *pRight){ ** Construct a new expression node for a function with multiple ** arguments. */ -Expr *sqlite3ExprFunction(Parse *pParse, ExprList *pList, Token *pToken){ +Expr *sqlite3ExprFunction( + Parse *pParse, /* Parsing context */ + ExprList *pList, /* Argument list */ + Token *pToken, /* Name of the function */ + int eDistinct /* SF_Distinct or SF_ALL or 0 */ +){ Expr *pNew; sqlite3 *db = pParse->db; assert( pToken ); @@ -950,10 +955,14 @@ Expr *sqlite3ExprFunction(Parse *pParse, ExprList *pList, Token *pToken){ sqlite3ExprListDelete(db, pList); /* Avoid memory leak when malloc fails */ return 0; } + if( pList && pList->nExpr > pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){ + sqlite3ErrorMsg(pParse, "too many arguments on function %T", pToken); + } pNew->x.pList = pList; ExprSetProperty(pNew, EP_HasFunc); assert( !ExprHasProperty(pNew, EP_xIsSelect) ); sqlite3ExprSetHeightAndFlags(pParse, pNew); + if( eDistinct==SF_Distinct ) ExprSetProperty(pNew, EP_Distinct); return pNew; } |