mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-24 08:21:29 +03:00
Avoid assertion faults in queries using indices with redundant columns.
Ticket [3dbdcdb14e7f41]. FossilOrigin-Name: 946e06cd2a2cc209b0786b7e9d28c0746320d646
This commit is contained in:
@@ -2897,7 +2897,7 @@ static void bestIndex(
|
||||
*/
|
||||
static void disableTerm(WhereLevel *pLevel, WhereTerm *pTerm){
|
||||
if( pTerm
|
||||
&& ALWAYS((pTerm->wtFlags & TERM_CODED)==0)
|
||||
&& (pTerm->wtFlags & TERM_CODED)==0
|
||||
&& (pLevel->iLeftJoin==0 || ExprHasProperty(pTerm->pExpr, EP_FromJoin))
|
||||
){
|
||||
pTerm->wtFlags |= TERM_CODED;
|
||||
@@ -3095,7 +3095,9 @@ static int codeAllEqualityTerms(
|
||||
int k = pIdx->aiColumn[j];
|
||||
pTerm = findTerm(pWC, iCur, k, notReady, pLevel->plan.wsFlags, pIdx);
|
||||
if( NEVER(pTerm==0) ) break;
|
||||
assert( (pTerm->wtFlags & TERM_CODED)==0 );
|
||||
/* The following true for indices with redundant columns.
|
||||
** Ex: CREATE INDEX i1 ON t1(a,b,a); SELECT * FROM t1 WHERE a=0 AND b=0; */
|
||||
testcase( (pTerm->wtFlags & TERM_CODED)!=0 );
|
||||
r1 = codeEqualityTerm(pParse, pTerm, pLevel, regBase+j);
|
||||
if( r1!=regBase+j ){
|
||||
if( nReg==1 ){
|
||||
|
||||
Reference in New Issue
Block a user