HV00NERRORTier 2 — Caution✅ HIGH confidencefdw_unable_to_establish_connection
🔴 Production Risk Error
High — foreign tables that cannot connect will block any query touching them, potentially causing application-wide failures
What this means
A foreign data wrapper could not establish a connection to the remote server. The remote server may be down, unreachable, or refusing connections.
Why it happens
- 1Remote server is not running or is unreachable at the configured host/port
- 2Firewall rules block the connection from the PostgreSQL server
- 3Wrong host, port, or database name in CREATE SERVER options
- 4Remote server max_connections limit reached
- 5SSL certificate validation failure when ssl=require is set
- 6User mapping credentials rejected by remote server
How to reproduce
First access to a foreign table backed by an unreachable remote server
SELECT * FROM my_foreign_table;Fix 1: Verify remote server host and port
Connection refused or timed out
SELECT srvoptions FROM pg_foreign_server WHERE srvname = 'myserver';Why this works
Corrects misconfigured connection parameters in the foreign server definition
Fix 2: Test connectivity from the PostgreSQL host
Network or firewall issue suspected
-- From OS: pg_isready -h remotehost -p 5432Why this works
Confirms whether the remote PostgreSQL port is accessible from the local server
What not to do
Do not store production credentials in user mappings without encryption
Why it's wrong: User mapping passwords are visible to superusers via pg_user_mappings
Sources
📚 Official docs: https://www.postgresql.org/docs/current/postgres-fdw.html
🔧 Source ref: https://www.postgresql.org/docs/current/errcodes-appendix.html
Confidence assessment
✅ HIGH confidence
Standard FDW error code from official PostgreSQL appendix; connection failure is the most common FDW error in production.
See also
📄 Reference pages