Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ROLLBACK TO does not alter the transaction stack #394

Merged
merged 1 commit into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/rs/core/src/automigrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ fn automigrate_impl(
let migrate_result = migrate_to(local_db, &mem_db);

if let Err(_) = migrate_result {
local_db.exec_safe("ROLLBACK TO automigrate_tables")?;
local_db.exec_safe("ROLLBACK")?;
let mem_db_err_msg = mem_db.errmsg()?;
ctx.result_error(&mem_db_err_msg);
ctx.result_error_code(mem_db.errcode());
Expand Down
4 changes: 2 additions & 2 deletions core/rs/core/src/backfill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ pub fn backfill_table(

if let Err(e) = result {
if !no_tx {
db.exec_safe("ROLLBACK TO backfill")?;
db.exec_safe("ROLLBACK")?;
}

return Err(e);
}

if let Err(e) = backfill_missing_columns(db, table, pk_cols, non_pk_cols, is_commit_alter) {
if !no_tx {
db.exec_safe("ROLLBACK TO backfill")?;
db.exec_safe("ROLLBACK")?;
}

return Err(e);
Expand Down
2 changes: 1 addition & 1 deletion core/rs/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pub extern "C" fn crsql_as_table(

if let Err(_) = crsql_as_table_impl(db, table) {
ctx.result_error("failed to downgrade the crr");
if let Err(_) = db.exec_safe("ROLLBACK TO as_table;") {
if let Err(_) = db.exec_safe("ROLLBACK") {
// fine.
}
return;
Expand Down