mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-23 00:45:37 +01:00
Merge 'emit SetCookie after DropTable' from Glauber Costa
The SetCookie opcode is used, among other things, to notify the transaction of schema changes. We are not issuing it on DropTable. Without it, the transaction thinks the schema hasn't changed, and does not update the schema of the connection back to the database. SQLite will, of course, issue it: 35 DropTable 0 0 0 foo 0 36 SetCookie 0 1 2 0 Unfortunately I don't have a unit test that breaks with this, because the one that is supposed to break is having, let's put it this way, bigger problems. Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com> Closes #2249
This commit is contained in:
@@ -932,6 +932,13 @@ pub fn translate_drop_table(
|
||||
table_name: tbl_name.name.0,
|
||||
});
|
||||
|
||||
program.emit_insn(Insn::SetCookie {
|
||||
db: 0,
|
||||
cookie: Cookie::SchemaVersion,
|
||||
value: schema.schema_version as i32 + 1,
|
||||
p5: 0,
|
||||
});
|
||||
|
||||
// end of the program
|
||||
program.epilogue(super::emitter::TransactionMode::Write);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user