sfackler / rust-postgres

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

Breaking change in `tokio-postgres` 0.7.9. #1062

Closed ryzhyk closed 1 year ago

ryzhyk commented 1 year ago

Thanks for these great crates!

It is probably too late to do anything about this, but just want to point out that tokio-postgres 0.7.9 introduced a breaking change, which I believe violates semantic versioning. Specifically, the Config::user field now defaults to the current user, which breaks any code that relies on Config::new() to create an empty config. For example I ran into this with the pg-client-config crate, namely, this function, which no longer initializes Config::user from the PGUSER environment variable.

sfackler commented 1 year ago

Hmm, we could defer the default to when the config is finalized I suppose.

dmarteau commented 1 year ago

Note that breaks also the database name which is also configured by default to user name.

sfackler commented 1 year ago

How does this break dbname?

dmarteau commented 1 year ago

Never mind, documentation was misleading me: The name of the database to connect to. Defaults to the username.

sfackler commented 1 year ago

Fixed in tokio-postgres v0.7.10/postgres v0.19.7.