/ Ticket Change Details
Login
Overview

Artifact ID: 0acc8b258a4e123cc90f019b95be4470bf21ab9ac55177e1a8369a264f5afad3
Ticket: 596d059af77f249314159d608e7449c899ea0764
Committing a transaction with a failed ALTER TABLE may subtly corrupt schema
User & Date: dan 2019-03-15 15:43:08
Changes

  1. icomment:
    <verbatim>
      CREATE TABLE t1(a, b);
      CREATE TABLE t3(e, f);
      CREATE TRIGGER tr1 AFTER INSERT ON t1 BEGIN
        INSERT INTO t2 VALUES(new.a, new.b);
      END;
      BEGIN;
        ALTER TABLE t3 RENAME TO t4;
      COMMIT;
      SELECT * FROM sqlite_master WHERE type='table' AND name!='t1';
    </verbatim>
    
    The output of the above script is:
    
    <verbatim>
      table|t3|t3|3|CREATE TABLE "t4"(e, f) 
    </verbatim>
    
    The schema is now corrupt - as the table name in the SQL does not match the table names in the "name" and "tbl_name" columns.
    
  2. login: "dan"
  3. mimetype: "text/x-fossil-wiki"
  4. severity changed to: "Critical"
  5. status changed to: "Open"
  6. title changed to:
    Committing a transaction with a failed ALTER TABLE may subtly corrupt schema
    
  7. type changed to: "Code_Defect"