Skip to main content

Module connection

Module connection 

Source
Expand description

The one PostgreSQL connection-string rule for every CLI command.

Seven call sites each decided “is this a PostgreSQL URL” with their own prefix test — starts_with("postgres"), or postgres:// / postgresql:// — and so disagreed about the libpq key=value form (host=db dbname=app) that PostgreSQL itself, tokio-postgres and the server all accept. The disagreement was not cosmetic: compile --database ran the drift check over a key=value string and then silently skipped the mutation-contract check, which asked the prefix question again (#1403).

The rule is now: refuse an engine whose support was removed, then accept whatever tokio_postgres::Config parses. Error messages never echo the connection string, which may carry a password.

Functions§

postgres_adapter
The adapter behind postgres_pool, for a command that executes through the runtime rather than reading the catalogue (doctor --runtime).
postgres_pool
A small connection pool for a CLI read, after require_postgres.
require_postgres
Check that db_url is a PostgreSQL connection string, in URL or libpq form.