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

Fix issues with quering from an auxiliary index that must refer back to the

PRIMARY KEY index of a WITHOUT ROWID table.

FossilOrigin-Name: cff1f55c52ff57557d9b728a5cd830a367091794
This commit is contained in:
drh
2013-10-31 17:38:01 +00:00
parent 6934fc7b6f
commit ee0ec8e1db
5 changed files with 22 additions and 11 deletions

View File

@@ -6191,7 +6191,13 @@ void sqlite3WhereEnd(WhereInfo *pWInfo){
for(; k<last; k++, pOp++){
if( pOp->p1!=pLevel->iTabCur ) continue;
if( pOp->opcode==OP_Column ){
i16 x = sqlite3ColumnOfIndex(pIdx, pOp->p2);
int x = pOp->p2;
Table *pTab = pIdx->pTable;
if( !HasRowid(pTab) ){
Index *pPk = sqlite3PrimaryKeyIndex(pTab);
x = pPk->aiColumn[x];
}
x = sqlite3ColumnOfIndex(pIdx, x);
if( x>=0 ){
pOp->p2 = x;
pOp->p1 = pLevel->iIdxCur;