08004: sqlserver_rejected_establishment_of_sqlconnection
PostgreSQLWhat does it mean?
The server was reached, but it refused to establish the connection. Network access exists, but the server did not accept this connection by policy.
Why does it happen?
The PostgreSQL server rarely produces this code; it is mostly reported by the client driver or the connection pool. The server's actual codes for similar rejections are different: a pg_hba.conf rejection ('no pg_hba.conf entry for host', the reject method) returns 28000 (invalid_authorization_specification), max_connections exhaustion returns 53300 (too_many_connections), and a connection refused during startup/shutdown returns 57P03.
How to fix it
Read the real SQLSTATE and reason for the rejection in the server log. For a pg_hba rejection (28000), add a matching line for the client IP, user and database (e.g. host all all 10.0.0.0/24 scram-sha-256) and reload with SELECT pg_reload_conf();. For connection saturation (53300), compare client connections with max_connections using SELECT count(*) FROM pg_stat_activity WHERE backend_type = 'client backend';