diff options
author | drh <> | 2023-03-25 21:01:11 +0000 |
---|---|---|
committer | drh <> | 2023-03-25 21:01:11 +0000 |
commit | de0416171b4f62bdd134ff6d97950f33050ad63a (patch) | |
tree | 797ad4a2b9db0a861fe8d9eea6b366cb64a60551 /src/expr.c | |
parent | 28ae1956583ebd539f6019d5c6be5e6c54a7c3b6 (diff) | |
download | sqlite-de0416171b4f62bdd134ff6d97950f33050ad63a.tar.gz sqlite-de0416171b4f62bdd134ff6d97950f33050ad63a.zip |
When the left table of a RIGHT JOIN is used inside an aggregate function
and the left table employs an index on expressions, then make sure the
expressions evaluate to NULL for the cases where the left table should be
NULL. Proposed fix for [forum:/forumpost/9b491e1deb|forum post 9b491e1deb].
More testing an analysis needed - there is a FIXME in this check-in.
FossilOrigin-Name: 3572b40a7dfc4acc35e72e08e79f64688f8737e57ac89e4d10e6b32bd5178c63
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/expr.c b/src/expr.c index 9e2ae0ebd..372e59803 100644 --- a/src/expr.c +++ b/src/expr.c @@ -4222,7 +4222,13 @@ expr_code_doover: AggInfo *pAggInfo = pExpr->pAggInfo; struct AggInfo_col *pCol; assert( pAggInfo!=0 ); - assert( pExpr->iAgg>=0 && pExpr->iAgg<pAggInfo->nColumn ); + assert( pExpr->iAgg>=0 ); + if( pExpr->iAgg>=pAggInfo->nColumn ){ + sqlite3VdbeAddOp2(v, OP_Null, 0, target); + /* FIXME: Need to verify that tests run this opcode + ** Some kind of coverage macro.. VdbeCoverage(v); tag-20230325-2 */ + break; + } pCol = &pAggInfo->aCol[pExpr->iAgg]; if( !pAggInfo->directMode ){ return AggInfoColumnReg(pAggInfo, pExpr->iAgg); |