SQLite

Check-in [c76a4c0b]
Login

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

Overview
Comment:Remove an obsolete assert() statement that no longer does anything useful and which is not always true. Fix for PoC #1 of forum post d7338bf4901f1151.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: c76a4c0b3cb625017ba09c8bccfcf1b5826df6873f1d3705d3345716079d5ec9
User & Date: drh 2022-01-01 17:21:55
Original Comment: Remove an obsolete assert() statement that no longer does anything useful and which is not always true. Fix for PoC #1 of forum post b03d86f951.
Context
2022-01-02
17:14
Remove an obsolete assert() statement that no longer does anything useful and which is not always true. Fix for PoC #1 of forum post b03d86f951. (check-in: 0829c100 user: drh tags: branch-3.37)
2022-01-01
19:29
Fix an obscure problem with releasing savepoints stored in an in-memory journal that could cause subsequent savepoint rollback to fail. Problem reported by forum post d7338bf4901f1151, PoC #3. The problem appears to have been introduced at [23ca23894af352ea]. (check-in: 73c2b502 user: dan tags: trunk)
17:21
Remove an obsolete assert() statement that no longer does anything useful and which is not always true. Fix for PoC #1 of forum post d7338bf4901f1151. (check-in: c76a4c0b user: drh tags: trunk)
12:26
Fix a faulty assert() statement - adding a CORRUPT_DB term - based on a test case derived from [562805cf488a455c]. Also add a test case to that prior issue. (check-in: 0dd6b5fc user: drh tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/insert.c.

2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
    if( aRegIdx[i]==0 ) continue;
    if( pIdx->pPartIdxWhere ){
      sqlite3VdbeAddOp2(v, OP_IsNull, aRegIdx[i], sqlite3VdbeCurrentAddr(v)+2);
      VdbeCoverage(v);
    }
    pik_flags = (useSeekResult ? OPFLAG_USESEEKRESULT : 0);
    if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){
      assert( pParse->nested==0 );
      pik_flags |= OPFLAG_NCHANGE;
      pik_flags |= (update_flags & OPFLAG_SAVEPOSITION);
      if( update_flags==0 ){
        codeWithoutRowidPreupdate(pParse, pTab, iIdxCur+i, aRegIdx[i]);
      }
    }
    sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iIdxCur+i, aRegIdx[i],







<







2543
2544
2545
2546
2547
2548
2549

2550
2551
2552
2553
2554
2555
2556
    if( aRegIdx[i]==0 ) continue;
    if( pIdx->pPartIdxWhere ){
      sqlite3VdbeAddOp2(v, OP_IsNull, aRegIdx[i], sqlite3VdbeCurrentAddr(v)+2);
      VdbeCoverage(v);
    }
    pik_flags = (useSeekResult ? OPFLAG_USESEEKRESULT : 0);
    if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){

      pik_flags |= OPFLAG_NCHANGE;
      pik_flags |= (update_flags & OPFLAG_SAVEPOSITION);
      if( update_flags==0 ){
        codeWithoutRowidPreupdate(pParse, pTab, iIdxCur+i, aRegIdx[i]);
      }
    }
    sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iIdxCur+i, aRegIdx[i],

Changes to test/without_rowid1.test.

466
467
468
469
470
471
472
473















474
    SELECT * FROM t1 WHERE a=20 OR (a=10 AND b=10);
  } {}
  do_execsql_test 14.2 {
    CREATE TABLE dual AS SELECT 'X' AS dummy;
    EXPLAIN QUERY PLAN SELECT * FROM dual, t1 WHERE a=10 AND b=10;
  } {~/b=/}
}
  















finish_test







|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
    SELECT * FROM t1 WHERE a=20 OR (a=10 AND b=10);
  } {}
  do_execsql_test 14.2 {
    CREATE TABLE dual AS SELECT 'X' AS dummy;
    EXPLAIN QUERY PLAN SELECT * FROM dual, t1 WHERE a=10 AND b=10;
  } {~/b=/}
}

# 2022-01-01 https://sqlite.org/forum/forumpost/b03d86f951 PoC #1
# Omit an assert() from 2013 that no longer serves any purpose and
# is no longer always true.
#
reset_db
do_execsql_test 15.1 {
  PRAGMA writable_schema=ON;
  CREATE TABLE sqlite_sequence (name PRIMARY KEY) WITHOUT ROWID;
  PRAGMA writable_schema=OFF;
  CREATE TABLE c1(x);
  INSERT INTO sqlite_sequence(name) VALUES('c0'),('c1'),('c2');
  ALTER TABLE c1 RENAME TO a;
  SELECT name FROM sqlite_sequence ORDER BY +name;
} {a c0 c2}

finish_test