1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Fix a problem with the handling of NULL values in the min() window function.

FossilOrigin-Name: b76f35b09235d44dc3d176377bbb9c18b7cdc9392800103ff53c54730a427a5c
This commit is contained in:
dan
2018-07-07 17:30:44 +00:00
parent e4984a2bf4
commit d4fc49f735
5 changed files with 37 additions and 10 deletions

View File

@@ -1085,6 +1085,8 @@ static void windowAggStep(
if( (pWin->pFunc->funcFlags & SQLITE_FUNC_MINMAX)
&& pWin->eStart!=TK_UNBOUNDED
){
int addrIsNull = sqlite3VdbeAddOp1(v, OP_IsNull, regArg);
VdbeCoverage(v);
if( bInverse==0 ){
sqlite3VdbeAddOp2(v, OP_AddImm, pWin->regApp+1, 1);
sqlite3VdbeAddOp2(v, OP_SCopy, regArg, pWin->regApp);
@@ -1096,6 +1098,7 @@ static void windowAggStep(
sqlite3VdbeAddOp1(v, OP_Delete, pWin->csrApp);
sqlite3VdbeJumpHere(v, sqlite3VdbeCurrentAddr(v)-2);
}
sqlite3VdbeJumpHere(v, addrIsNull);
}else if( pWin->regApp ){
assert( pWin->pFunc->xSFunc==nth_valueStepFunc
|| pWin->pFunc->xSFunc==first_valueStepFunc