PostgreSQL (rust-postgres)

The postgres driver connects to PostgreSQL using the native rust-postgres client.

URL format

postgres://<user>[:<password>]@<host>[:<port>]/<database>[?<options>]

Options

OptionBehavior / default
application_nameName reported for the session.
connect_timeoutConnection timeout in seconds.
optionsURL-encoded server startup options.
sslmodeThis driver uses NoTls; disable explicitly selects an unencrypted connection. Use the postgresql driver for TLS connections.
embeddedStart a managed local PostgreSQL server when true; default false.
versionEmbedded PostgreSQL version requirement; default =18.6.0.
installation_dirDirectory for the downloaded PostgreSQL installation.
data_dirEmbedded server data directory.
temporaryRemove temporary server data after use; defaults to true.
timeoutEmbedded setup/start/stop command timeout in seconds.
releases_urlDownload source for embedded PostgreSQL releases.
password_filePath to the embedded server password file.
socket_dirUnix socket directory for the embedded server.
trust_installation_dirTrust an existing installation directory when true; default false.
configuration.<name>Embedded PostgreSQL server setting, for example configuration.max_connections=100.

Examples

rsql --url 'postgres://postgres@localhost:5432/example?sslmode=disable' -- 'SELECT version();'
rsql --url 'postgres://?embedded=true' -- 'SELECT 42;'

Usage notes

The default PostgreSQL port is 5432. Connection parameters are parsed by rust-postgres.

With embedded=true, rsql downloads and starts a managed PostgreSQL instance and creates the embedded database. It stops the server when the connection closes. The first setup needs network access unless the PostgreSQL installation is already cached. For TLS connections, use PostgreSQL (SQLx).