代码之家  ›  专栏  ›  技术社区  ›  Lajos Arpad

为什么在回滚事务中创建的列在事务之后存在?

  •  0
  • Lajos Arpad  · 技术社区  · 6 年前

    如果我在回滚的事务中创建一个列,那么该列在事务之后仍然存在,但是,我希望该列由于回滚而不存在。问题是:这种行为的原因是什么?

    create table test(
        id int primary key auto_increment,
        foo text
    );
    
    insert into test(foo) values ('a'), ('b'), ('c');
    
    start transaction;
    
    alter table test add column bar text;
    
    rollback;
    
    desc test;
    
    0 回复  |  直到 6 年前