sfackler / rust-postgres

Native PostgreSQL driver for the Rust programming language
Apache License 2.0
3.39k stars 429 forks source link

`TransactionBuilder::start` Future dropped before completion #1120

Open wquark opened 4 months ago

wquark commented 4 months ago

batch_execute submits the creation of the transaction (https://github.com/sfackler/rust-postgres/blob/master/tokio-postgres/src/transaction_builder.rs#L109), but the Transaction object itself may never be constructed in case the future is dropped.

https://github.com/sfackler/rust-postgres/commit/f6189a95f24af45068ecfd6e3c4e6b71ac8e43fe fixed it for Client::transaction.

sfackler commented 4 months ago

Good find. We should probably implement transaction with TransactionBuilder to avoid having two places that need to deal with this.

wquark commented 3 months ago

Makes sense. Anything else you need from my end? Is this something you'd knock out quickly or would you rather have a PR?

sfackler commented 3 months ago

Either way!