Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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 via environment variables (same as psql). Environment variables apply to all PostgreSQL connections. See environment vars for details.

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 guarnatees regarding eavesdropping or MITM protection, you need a different option. Use the sslmode parameter to specify a different mode:

martin postgresql://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.