Skip to main content

PostgreSQL Connections

TablePro supports PostgreSQL 12 and later via the libpq C connector. Schema browsing, rich type display (JSONB, arrays, UUID, inet), and all standard PostgreSQL query features work out of the box.

Quick Setup

1

Create Connection

Click New Connection, select PostgreSQL, enter host/port/username/password/database, and click Create
2

Test Connection

Click Test Connection to verify

Connection Settings

FieldDefaultNotes
Hostlocalhost
Port5432
Usernamepostgres
Database-Required (unlike MySQL)
Open URLs like postgresql://user:pass@host/db directly to connect. See Connection URL Reference.
PostgreSQL connection form

Example Configurations

Local: host localhost:5432, user postgres, “trust” auth (no password) with Homebrew Docker: host localhost:5432, password from POSTGRES_PASSWORD env AWS RDS: Use endpoint hostname, standard credentials Heroku: Parse DATABASE_URL for credentials Remote: Use SSH tunneling for secure access

Features

Sidebar displays all accessible schemas and tables. Switch databases/schemas with Cmd+K. Table info shows structure (columns, indexes, constraints) and DDL. Full PostgreSQL syntax support:
-- JSONB queries
SELECT data->>'name' as name, data->'address'->>'city' as city
FROM customers
WHERE data @> '{"active": true}'::jsonb;

-- Array operations
SELECT name, tags
FROM products
WHERE 'electronics' = ANY(tags);

-- Window functions
SELECT
    department,
    employee,
    salary,
    salary - LAG(salary) OVER (PARTITION BY department ORDER BY hire_date) as salary_change
FROM employees;

-- CTEs with RETURNING
WITH inserted AS (
    INSERT INTO orders (customer_id, total)
    VALUES (1, 99.99)
    RETURNING *
)
SELECT * FROM inserted;

-- Full-text search
SELECT title, ts_rank(search_vector, query) as rank
FROM articles, to_tsquery('english', 'database & performance') query
WHERE search_vector @@ query
ORDER BY rank DESC;

PostgreSQL-Specific Types

Supports jsonb (formatted JSON), array, uuid, inet (IP), timestamp with time zone, interval, bytea (binary).

Troubleshooting

Connection refused: Check server is running (brew services start postgresql@16), verify listen_addresses in postgresql.conf, ensure firewall allows port 5432. Auth failed: Check pg_hba.conf for correct auth method (md5/scram-sha-256 for passwords, trust for local dev). Reset password with ALTER USER postgres WITH PASSWORD 'newpassword'; Database doesn’t exist: Connect to postgres database and create it with CREATE DATABASE myapp; Permission denied: Grant access with GRANT ALL ON DATABASE/SCHEMA/TABLES TO username; SSL/TLS: Cloud providers (AWS RDS, Heroku, Supabase) typically require SSL. Use Required or Verify CA. For unencrypted alternatives, use SSH tunneling.

Advanced Configuration

Startup Commands (Advanced tab): Set session variables like SET timezone = 'UTC'; SET search_path TO myschema, public; to apply automatically on connect. ~/.pgpass Support: Use format hostname:port:database:username:password with wildcards (*). Must have chmod 0600 permissions. Pre-Connect Script (Advanced tab): Run a shell script before connecting (e.g., to refresh credentials from a secrets manager). 10-second timeout. PostgreSQL Extensions: PostGIS, hstore, ltree work out of the box. Check with SELECT * FROM pg_extension; Performance: Use EXPLAIN ANALYZE for query optimization. LIMIT large exploratory queries, create indexes, enable pagination. MySQL Migration Notes: Use SERIAL (not AUTO_INCREMENT), LIMIT y OFFSET x syntax, double quotes for identifiers, GENERATED AS IDENTITY for new schemas.