1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-11 01:42:22 +03:00

When the result of a subquery is to be stored in a register and that

subquery has an ORDER BY clause and an OFFSET, NULL out the destination
register before starting the ORDER BY so that the register will be set
correctly even if the OFFSET is larger than the number of output rows.
Fix for the problem reported in
[forum:/forumpost/0ec80f12d02acb3f|forum post 0ec80f12d02acb3f].

FossilOrigin-Name: 9282bcde301cee2a5c3c068b5b0b7ce992c155ece894413a6a9a51a81e4133fd
This commit is contained in:
drh
2022-01-12 20:31:14 +00:00
parent 04f97602e2
commit 8efc6a8c09
4 changed files with 31 additions and 9 deletions

View File

@@ -1575,6 +1575,9 @@ static void generateSortTail(
iTab = pSort->iECursor;
if( eDest==SRT_Output || eDest==SRT_Coroutine || eDest==SRT_Mem ){
if( eDest==SRT_Mem && p->iOffset ){
sqlite3VdbeAddOp2(v, OP_Null, 0, pDest->iSdst);
}
regRowid = 0;
regRow = pDest->iSdst;
}else{