Skip to content

PostgreSQL Connections

Martin supports standard PostgreSQL connection string settings including host, port, user, password, dbname, sslmode, connect_timeout, keepalives, keepalives_idle, etc. See the PostgreSQL docs for more details.

SSL Connections

Martin supports PostgreSQL sslmode settings: disable, prefer, require, verify-ca and verify-full. See the PostgreSQL docs for mode descriptions. Certificates can be provided in the configuration file or on the command line with --ssl-cert, --ssl-key and --ca-root-file. The command line flags apply to all PostgreSQL connections.

By default, sslmode is prefer - encrypt (don't check certificates) if the server supports it, but the connection proceeds without SSL if not supported. This matches psql default behavior.

If you require guarantees regarding eavesdropping or MITM protection, you need a different option. Use the sslmode parameter to specify a different mode:

martin postgres://user:password@host/db?sslmode=verify-full

For a practical walkthrough of SSL certificate setup - including creation, configuration, and troubleshooting - see our PostgreSQL SSL Certificates Recipe.