-
-
Notifications
You must be signed in to change notification settings - Fork 419
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
Fix transction rollback on Future
drop
#1121
base: master
Are you sure you want to change the base?
Conversation
Looks good to me other than the one nit! |
Looks like it needs a diff --git a/postgres-types/src/chrono_04.rs b/postgres-types/src/chrono_04.rs
index d599bde0..64166309 100644
--- a/postgres-types/src/chrono_04.rs
+++ b/postgres-types/src/chrono_04.rs
@@ -111,9 +111,10 @@ impl ToSql for DateTime<FixedOffset> {
impl<'a> FromSql<'a> for NaiveDate {
fn from_sql(_: &Type, raw: &[u8]) -> Result<NaiveDate, Box<dyn Error + Sync + Send>> {
let jd = types::date_from_sql(raw)?;
+ let jd = Duration::try_days(jd)?;
base()
.date()
- .checked_add_signed(Duration::days(i64::from(jd)))
+ .checked_add_signed(jd)
.ok_or_else(|| "value too large to decode".into())
} |
- fixes drop of `Future` after synchronous message send but before `Transaction` object creation - follow-on to sfackler@f6189a9 for `TransactionBuilder` and savepoint `Transaction::transaction` creation
- use non-deprecated `Duration::try_days` method - remove redundant top-level `rand` import
Ran |
Hey @sfackler, would be great to get this pushed forward so we can remove our patched dependencies. Let me know if there are other blockers, thanks. |
@sfackler another bump on merging this PR. Any other blockers? |
PR for #1120. Also rollsback the savepoint (found while implementing this).