SQLite

Check-in [221fdcec]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a problem in cursor-hints for WITHOUT ROWID tables used in a RIGHT JOIN. Forum post 591006b1cc.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 221fdcec964f8317b2c23e926cc23799615cd3b4239a8a9ff87a83588d05bc64
User & Date: drh 2023-03-24 19:17:25
References
2023-03-25
02:07
New test case to further validate the fix at [221fdcec964f8317]. Forum post d34ad68c36. (check-in: a6e218a6 user: drh tags: trunk)
Context
2023-03-25
02:02
Fix a problem in cursor-hints for WITHOUT ROWID tables. (check-in: fc8ec188 user: drh tags: branch-3.41)
2023-03-24
20:35
Fix the handling of indexed expressions in an outer query that appear as corelated values inside an aggregate function within a subquery. Forum post 79cf371080. (check-in: d8259877 user: drh tags: trunk)
19:17
Fix a problem in cursor-hints for WITHOUT ROWID tables used in a RIGHT JOIN. Forum post 591006b1cc. (check-in: 221fdcec user: drh tags: trunk)
17:15
Add a JS test which checks for the issue described in forum post 895425b49a. (check-in: 98d30400 user: stephan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/where.c.
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
        Bitmask b = pTabItem->colUsed;
        int n = 0;
        for(; b; b=b>>1, n++){}
        sqlite3VdbeChangeP4(v, -1, SQLITE_INT_TO_PTR(n), P4_INT32);
        assert( n<=pTab->nCol );
      }
#ifdef SQLITE_ENABLE_CURSOR_HINTS
      if( pLoop->u.btree.pIndex!=0 ){
        sqlite3VdbeChangeP5(v, OPFLAG_SEEKEQ|bFordelete);
      }else
#endif
      {
        sqlite3VdbeChangeP5(v, bFordelete);
      }
#ifdef SQLITE_ENABLE_COLUMN_USED_MASK







|







6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
        Bitmask b = pTabItem->colUsed;
        int n = 0;
        for(; b; b=b>>1, n++){}
        sqlite3VdbeChangeP4(v, -1, SQLITE_INT_TO_PTR(n), P4_INT32);
        assert( n<=pTab->nCol );
      }
#ifdef SQLITE_ENABLE_CURSOR_HINTS
      if( pLoop->u.btree.pIndex!=0 && (pTab->tabFlags & TF_WithoutRowid)==0 ){
        sqlite3VdbeChangeP5(v, OPFLAG_SEEKEQ|bFordelete);
      }else
#endif
      {
        sqlite3VdbeChangeP5(v, bFordelete);
      }
#ifdef SQLITE_ENABLE_COLUMN_USED_MASK
Changes to test/cursorhint.test.
154
155
156
157
158
159
160









161
162
  }
} {AND(AND(EQ(c0,22),GE(c1,10)),LE(c1,20))}
do_test 4.6desc {
  p4_of_opcode db CursorHint {
    SELECT rowid FROM t1 WHERE b=22 AND c>=10 AND c<=20 ORDER BY b,c DESC;
  }
} {AND(AND(EQ(c0,22),GE(c1,10)),LE(c1,20))}










finish_test







>
>
>
>
>
>
>
>
>


154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
  }
} {AND(AND(EQ(c0,22),GE(c1,10)),LE(c1,20))}
do_test 4.6desc {
  p4_of_opcode db CursorHint {
    SELECT rowid FROM t1 WHERE b=22 AND c>=10 AND c<=20 ORDER BY b,c DESC;
  }
} {AND(AND(EQ(c0,22),GE(c1,10)),LE(c1,20))}

# 2023-03-24 https://sqlite.org/forum/forumpost/591006b1cc
#
reset_db
do_execsql_test 5.0 {
  CREATE TABLE t1(x TEXT PRIMARY KEY) WITHOUT ROWID;
  CREATE VIEW t2 AS SELECT 0 FROM t1 WHERE x>='a' OR x='1';
  SELECT * FROM t2 RIGHT JOIN t1 ON true;
}

finish_test