1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-18 10:21:03 +03:00

Fix the skip-ahead-distinct optimization on joins for cases there the table

in the inner loop of the join does not contribute any columns to the
result set.  Proposed fix for ticket [ef9318757b152e3a2]

FossilOrigin-Name: 2dcef5a9ae7f347da65207bf6bf612fb12e18e1a6704799322f0cf2a86154cfd
This commit is contained in:
drh
2017-11-21 23:38:48 +00:00
parent 041343dea1
commit 065b34f6e5
4 changed files with 35 additions and 9 deletions

View File

@@ -4978,6 +4978,13 @@ void sqlite3WhereEnd(WhereInfo *pWInfo){
VdbeCoverageIf(v, op==OP_SeekLT);
VdbeCoverageIf(v, op==OP_SeekGT);
sqlite3VdbeAddOp2(v, OP_Goto, 1, pLevel->p2);
if( i<pWInfo->nLevel-1 ){
/* Ticket https://sqlite.org/src/info/ef9318757b152e3 2017-11-21
** The break location for the next inner loop is above the code
** generated here, but it should be afterwards. So call re-resolve
** the break location to be afterwards. */
sqlite3VdbeResolveLabel(v, pWInfo->a[i+1].addrBrk);
}
}
#endif /* SQLITE_DISABLE_SKIPAHEAD_DISTINCT */
/* The common case: Advance to the next row */