sfackler / rust-postgres

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

`tokio-postgres` fails to connect via socket with trust authentication #1057

Closed ISibboI closed 1 year ago

ISibboI commented 1 year ago

I am connecting to a database with the url:

postgresql:///rvoc_dev?host=/home/stuff/data/postgres_dev

The connection works when using the PgConnection exposed by diesel, but not when using the AsyncPgConnection exposed by diesel-async, which uses tokio-postgres.

With async, I get:

"no PostgreSQL user name specified in startup packet"

According to cargo tree, I am using tokio postgres v0.7.8.

sfackler commented 1 year ago

diesel is based off of libpq which will default to the the OS-level username if it is not specified in the connection string, but tokio-postgres currently does not.

ISibboI commented 1 year ago

I see thanks. Would be nice if the behavior of libpq would be replicated :)

sfackler commented 1 year ago

Yeah I think that's a reasonable feature to add.

trungda commented 1 year ago

Is this similar to this issue https://github.com/sfackler/rust-postgres/issues/1024?

ISibboI commented 1 year ago

Yes, this is a duplicate.