-
-
Notifications
You must be signed in to change notification settings - Fork 521
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
PostgreSQL insert many with returning #1021
Conversation
aaa791e
to
6d3ba03
Compare
src/error.rs
Outdated
@@ -17,6 +17,10 @@ pub enum DbErr { | |||
Json(String), | |||
/// A migration error | |||
Migration(String), | |||
/// None of the records are being inserted into the database, | |||
/// if you insert with upcert expression that means |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
upsert
Thank you. Since #1002 has been merged, I'd like this to nest under the |
6d3ba03
to
9d0f3f6
Compare
…m are being inserted
9d0f3f6
to
6f44907
Compare
I think some of the errors that reside at the So, to be consistent I'd like Lines 5 to 75 in 9d0f3f6
|
let rows = db.query_all(statement).await?; | ||
let res = rows.last().ok_or_else(|| { | ||
DbErr::RecordNotInserted("None of the records are being inserted".to_owned()) | ||
})?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually after a second thought I think it all makes sense.
Because there is no SQLx error at all (if there is, we'd like to keep the source
)
…m are being inserted (SeaQL#1021)
PR Info
insert_many
withon_conflict
anddo_nothing
panics if no rows are inserted. #899Breaking Changes
DbErr::RecordNotInserted
if none of the records are being inserted