aboutsummaryrefslogtreecommitdiff
path: root/src/wherecode.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2019-11-06 17:31:18 +0000
committerdrh <drh@noemail.net>2019-11-06 17:31:18 +0000
commit4fb24c82cd6bedf39e8c536eb3d1563eca11544a (patch)
tree52fc22841564a9bdec817a275bf535afcf5b866a /src/wherecode.c
parentb1129c423f0cda7c76a3664dd91e84701f431cc5 (diff)
downloadsqlite-4fb24c82cd6bedf39e8c536eb3d1563eca11544a.tar.gz
sqlite-4fb24c82cd6bedf39e8c536eb3d1563eca11544a.zip
Fix the OP_DeferredSeek index-to-table column map in P4 so that it works
with generated columns. Ticket [ce22a07731530118] FossilOrigin-Name: 36c11ad51fe9ab1bde0b98d0ea9b8588e07d168cd8027486749372894941ad93
Diffstat (limited to 'src/wherecode.c')
-rw-r--r--src/wherecode.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/wherecode.c b/src/wherecode.c
index b9801407b..4d125fdb6 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -1054,8 +1054,12 @@ static void codeDeferredSeek(
if( ai ){
ai[0] = pTab->nCol;
for(i=0; i<pIdx->nColumn-1; i++){
+ int x1, x2;
assert( pIdx->aiColumn[i]<pTab->nCol );
- if( pIdx->aiColumn[i]>=0 ) ai[pIdx->aiColumn[i]+1] = i+1;
+ x1 = pIdx->aiColumn[i];
+ x2 = sqlite3TableColumnToStorage(pTab, x1);
+ testcase( x1!=x2 );
+ if( pIdx->aiColumn[i]>=0 ) ai[x2+1] = i+1;
}
sqlite3VdbeChangeP4(v, -1, (char*)ai, P4_INTARRAY);
}