PostgreSQL (SQLx)

The postgresql driver connects to PostgreSQL (SQLx) using the PostgreSQL protocol.

URL format

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

Options

OptionBehavior / default
sslmodeTLS mode: disable, allow, prefer, require, verify-ca, or verify-full. SQLx defaults to prefer unless configured by the environment.
sslrootcertCA certificate file. Aliases: ssl-root-cert, ssl-ca.
sslcert / sslkeyClient certificate and key files for certificate authentication.
application_nameName reported for the PostgreSQL session.
optionsServer startup options, for example -c search_path=public, URL-encoded.
statement-cache-capacityPrepared-statement cache size per connection; default 100.
host / hostaddr / port / dbname / user / passwordConnection fields; query values override matching URL fields.
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 'postgresql://user:password@localhost:5432/example' -- 'SELECT 1;'
rsql --url 'postgresql://?embedded=true' -- 'SELECT version();'

Usage notes

The connection uses the PostgreSQL wire protocol through SQLx. Specify the service port explicitly; the underlying connection defaults to port 5432. The example uses port 5432. Use .catalogs, .schemas, .tables, and .describe to inspect accessible objects.

With embedded=true, rsql downloads and starts PostgreSQL, creates a database named embedded, and stops the server when the connection closes. Embedded options apply only in this mode. The initial setup needs network access unless the installation is already cached.