create_pool

Function create_pool 

Source
pub async fn create_pool(url: &str, application_name: &str) -> Result<PgPool>
Expand description

Create a connection pool from a connection URL

Supports Unix socket connections via:

  • Query parameter: postgresql:///dbname?host=/var/run/postgresql
  • Percent-encoded host: postgresql://%2Fvar%2Frun%2Fpostgresql/dbname
  • Empty host (auto-detects Unix socket or falls back to localhost): postgresql:///dbname

Unix socket connections automatically disable SSL/TLS.

ยงPassword Prompting

If the connection fails with an authentication error and no password was provided in the connection URL, the function will prompt the user to enter a password interactively. The password will be read securely without echoing to the terminal.