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

Fix the ORDER BY optimization logic so that it will do a block-sort on

a partial DESC ORDER BY.  This enhancement uncovered a memory leak in
pushUntoSorter() which is also fixed.

FossilOrigin-Name: c36f74611cf17ad2ff198a2ac2054d7ab451a72c
This commit is contained in:
drh
2014-03-22 00:27:14 +00:00
parent 9a4444778f
commit 59b8f2e108
4 changed files with 20 additions and 19 deletions

View File

@@ -488,6 +488,7 @@ static void pushOntoSorter(
addrFirst = sqlite3VdbeAddOp1(v, OP_IfNot, regBase+nExpr); VdbeCoverage(v);
sqlite3VdbeAddOp3(v, OP_Compare, regPrevKey, regBase, pSort->nOBSat);
pOp = sqlite3VdbeGetOp(v, pSort->addrSortIndex);
if( pParse->db->mallocFailed ) return;
pOp->p2 = nKey + 1;
sqlite3VdbeChangeP4(v, -1, (char*)pOp->p4.pKeyInfo, P4_KEYINFO);
pOp->p4.pKeyInfo = keyInfoFromExprList(pParse, pSort->pOrderBy, nOBSat, 1);