Always make sure the left-hand side of the IS NOT NULL operator is a

smiple column, not a general expression, before applying the IS NOT NULL
query optimization.

FossilOrigin-Name: 543f75a6abe3aa4f49df43e71a462702d40b3251
This commit is contained in:
drh
2011-04-08 21:35:26 +00:00
parent 1c152101ca
commit ea6dc4458b
4 changed files with 15 additions and 10 deletions
+4 -1
View File
@@ -1342,7 +1342,10 @@ static void exprAnalyze(
** of the loop. Without the TERM_VNULL flag, the not-null check at
** the start of the loop will prevent any results from being returned.
*/
if( pExpr->op==TK_NOTNULL && pExpr->pLeft->iColumn>=0 ){
if( pExpr->op==TK_NOTNULL
&& pExpr->pLeft->op==TK_COLUMN
&& pExpr->pLeft->iColumn>=0
){
Expr *pNewExpr;
Expr *pLeft = pExpr->pLeft;
int idxNew;