Skip to content

Commit

Permalink
fix: correctly handle on conflict for inserting user privilege
Browse files Browse the repository at this point in the history
  • Loading branch information
yezizp2012 committed Mar 12, 2024
1 parent ed37e34 commit c0cde55
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/meta/src/controller/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,18 @@ impl CatalogController {
} else {
on_conflict.do_nothing();
}
UserPrivilege::insert(privilege)
let res = UserPrivilege::insert(privilege)
.on_conflict(on_conflict)
.exec(&txn)
.await?;
.await;
if let Err(err) = res {
if !matches!(
err,
sea_orm::DbErr::RecordNotInserted | sea_orm::DbErr::RecordNotUpdated
) {
return Err(err.into());
}
}
}

let user_infos = list_user_info_by_ids(user_ids, &txn).await?;
Expand Down

0 comments on commit c0cde55

Please sign in to comment.