1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-10 01:02:56 +03:00

Add usage detection to the NULL value generator for the left table of a

RIGHT JOIN inside of an aggregate.

FossilOrigin-Name: 4d05a009dfb63bcb4173da4d09ccc00c308ce4dd2534a32aeb23c5d8d6a1fd4b
This commit is contained in:
drh
2023-03-25 23:40:21 +00:00
parent de0416171b
commit debc3202c6
3 changed files with 15 additions and 9 deletions

View File

@@ -4224,9 +4224,15 @@ expr_code_doover:
assert( pAggInfo!=0 );
assert( pExpr->iAgg>=0 );
if( pExpr->iAgg>=pAggInfo->nColumn ){
/* Happens when the left table of a RIGHT JOIN is null and
** is using an expression index */
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 */
#ifdef SQLITE_VDBE_COVERAGE
/* Verify that the OP_Null above is exercised by tests
** tag-20230325-2 */
sqlite3VdbeAddOp2(v, OP_NotNull, target, 1);
VdbeCoverageNeverTaken(v);
#endif
break;
}
pCol = &pAggInfo->aCol[pExpr->iAgg];