PostgreSQL Guide
Everything you need to connect to and work with PostgreSQL databases in SQLAgent.
Getting Started
How do I connect to PostgreSQL?
Select PostgreSQL in the database picker, then fill in:
- Host —
localhostor your server's address - Port — default is
5432 - Username — your PostgreSQL user (often
postgres) - Password — your PostgreSQL password
- Database — optional, you can pick one after connecting
Click Connect and you're in. SQLAgent uses a pure Swift implementation of the PostgreSQL wire protocol — no libpq, no ODBC.
Which PostgreSQL versions are supported?
SQLAgent supports PostgreSQL 12 and later. Authentication uses SCRAM-SHA-256 (the default since PostgreSQL 14) as well as MD5 for older setups.
Does SQLAgent support JSONB browsing?
Yes. JSONB columns are displayed with formatted values in the data grid. You can browse, search, and query JSONB data like any other column type.
Security & Permissions
SSL/TLS encryption
Enable SSL in the connection form to encrypt traffic. PostgreSQL supports full TLS with optional client certificate authentication (mTLS). Provide a CA certificate, client certificate, and client key for maximum security.
SSH tunneling
For databases behind a firewall or bastion host, enable the SSH tunnel section. SQLAgent supports SSH key, SSH agent, and password authentication. The tunnel is established automatically before connecting to PostgreSQL.
Security banner
Before you connect, SQLAgent shows a security banner summarizing your connection's posture:
- Local connection — green, data stays on your machine
- Remote + TLS — green, encrypted
- Remote + SSH — green, tunneled
- Remote + SSH + TLS — green, double-layered encryption
- Remote, no encryption — orange warning, credentials sent in plain text
PostgreSQL permissions model
PostgreSQL uses role-based access control (RBAC). Users are roles with login privileges. Roles can own objects, inherit permissions from other roles, and have fine-grained privileges on databases, schemas, and tables. To list roles and their attributes, run:
\du
To see privileges on a specific table:
\dp table_name
The security banner on the connection form notes this — so you know what access model to expect before connecting.
Troubleshooting
Connection timeout or refused
Check that your PostgreSQL server is running and accessible. Verify the host, port, and credentials. Make sure pg_hba.conf allows connections from your IP. For cloud databases (Supabase, Neon, etc.), check that your IP is whitelisted.
Authentication failed
Double-check your username and password. PostgreSQL 14+ defaults to scram-sha-256 authentication. If you're connecting to an older server using md5, SQLAgent handles that automatically.
SSL handshake errors
Make sure your certificates are in PEM format. If connecting to a self-signed server, try toggling Verify server certificate. For cloud PostgreSQL (Supabase, RDS), the CA certificate is usually provided by the host.
SSL connection required by server
The server requires an encrypted connection. Enable SSL in the connection form. You may also need to provide a CA certificate if the server uses a custom cert.
See the full Error Reference for all error messages.