aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <>2024-08-10 14:53:21 +0000
committerdrh <>2024-08-10 14:53:21 +0000
commit6010980914207275bcc82e58e534d2923667f631 (patch)
treee6c54bf95bd94bbc2664143fac8253f3a8676ede /src
parentfe4ed96006fe32ba7fcdb0fdc8bb34e7083a7ebe (diff)
downloadsqlite-6010980914207275bcc82e58e534d2923667f631.tar.gz
sqlite-6010980914207275bcc82e58e534d2923667f631.zip
Fix behavior change in the offset() SQL function introduced by
check-in [f0b671183f44d0ae]. FossilOrigin-Name: c2ac17f183082d6388336338b8d5c0b334095e5f77a27bc08419431f37471d22
Diffstat (limited to 'src')
-rw-r--r--src/where.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/where.c b/src/where.c
index 15f5fe7d9..98e9f117f 100644
--- a/src/where.c
+++ b/src/where.c
@@ -7358,20 +7358,18 @@ void sqlite3WhereEnd(WhereInfo *pWInfo){
assert( pIdx->pTable==pTab );
#ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC
if( pOp->opcode==OP_Offset ){
- x = 0;
+ /* Do not need to translate the column number */
}else
#endif
- {
- if( !HasRowid(pTab) ){
- Index *pPk = sqlite3PrimaryKeyIndex(pTab);
- x = pPk->aiColumn[x];
- assert( x>=0 );
- }else{
- testcase( x!=sqlite3StorageColumnToTable(pTab,x) );
- x = sqlite3StorageColumnToTable(pTab,x);
- }
- x = sqlite3TableColumnToIndex(pIdx, x);
+ if( !HasRowid(pTab) ){
+ Index *pPk = sqlite3PrimaryKeyIndex(pTab);
+ x = pPk->aiColumn[x];
+ assert( x>=0 );
+ }else{
+ testcase( x!=sqlite3StorageColumnToTable(pTab,x) );
+ x = sqlite3StorageColumnToTable(pTab,x);
}
+ x = sqlite3TableColumnToIndex(pIdx, x);
if( x>=0 ){
pOp->p2 = x;
pOp->p1 = pLevel->iIdxCur;