Skip to main content

postgres_pool

Function postgres_pool 

Source
pub async fn postgres_pool(
    db_url: &str,
    purpose: &str,
    tls: &PostgresTlsConfig,
) -> Result<Pool>
Expand description

A small connection pool for a CLI read, after require_postgres.

Built by fraiseql-db’s own pool constructor, so the CLI and the server share one TLS policy (#1429): the URL’s sslmode applies when tls sets no mode, a mode in tls (from [database] ssl_mode) overrides it, and the connector negotiates TLS rather than refusing it. The first connection is opened here, and the server is refused below the supported PostgreSQL floor before the command reads anything.

purpose completes “failed to connect to PostgreSQL for …”.

§Errors

Returns the require_postgres error, one naming purpose when the server cannot be reached or the TLS settings cannot be honoured, and the floor refusal for a server older than PostgreSQL 18.