# HV00N — fdw_unable_to_establish_connection

> PostgreSQL SQLSTATE HV00N identifies an FDW connection-establishment failure. The actual connection layer and diagnostic must come from the wrapper.
---

# HV00N — fdw_unable_to_establish_connection

## At a glance {#at-a-glance}

`HV00N` is the SQL/MED condition for an FDW unable to establish its connection. No direct 18.6 core/contrib `HV00N` report group was resolved. Do not use the condition name to choose between DNS, authentication, TLS, network, or remote-server causes.

<!-- BEGIN SQLSTATE FACTS: generated by scripts/generate.py; do not edit -->

| Field | Value |
| --- | --- |
| SQLSTATE | `HV00N` |
| Condition | `fdw_unable_to_establish_connection` |
| Status | `active` |
| Known present by | `9.1.0` |
| Locked snapshots | `9.1.24, 9.2.24, 9.3.25, 9.4.26, 9.5.25, 9.6.24, 10.23, 11.22, 12.22, 13.23, 14.24, 15.19, 16.15, 17.11, 18.6, 19beta3` |
| Macros | `ERRCODE_FDW_UNABLE_TO_ESTABLISH_CONNECTION` |
| Aliases | `—` |

<!-- source facts: data/errcodes/HV00N.json -->
<!-- END SQLSTATE FACTS -->

## Meaning {#meaning}

The condition name describes a wrapper connection-setup boundary. `postgres_fdw` and dblink have their own concrete connection and libpq paths, but the 18.6 paths in this batch use other SQLSTATEs; they are not evidence for `HV00N`.

## Messages and diagnostics {#messages}

No fixed core message is confirmed. Preserve wrapper/driver version, foreign server and user mapping, connection parameters (excluding secrets), local and remote logs, and whether authentication or transport was reached.

## Diagnosis {#diagnosis}

Locate the wrapper's connection function and classify the first failing layer: name resolution, socket/TLS, authentication, protocol negotiation, or remote admission. Compare the wrapper's SQLSTATE with any driver or remote code; they can differ.

## Response {#response}

Correct the identified endpoint, credentials, network/TLS configuration, or server admission rule, then establish a fresh connection using the wrapper's API. For writes, do not replay an operation until logs show whether a prior connection reached the remote command stage.

## Versions {#versions}

The code is in locked definitions from 9.1.0 through 18.6 and 19 Beta 3; available pre-9 definitions do not contain it. Exact implementation introduction is unknown.

## Related {#related}

[`HV001`](../hv001/) is a confirmed allocation path; [`HV00L`](../hv00l/) concerns execution creation after setup; [`08006`](../08006/) is a broader connection failure class.

## Sources {#sources}

- [`errcodes.txt`](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt#L485) — definition, SHA-256 `6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba`.
- [`fdwapi.h`](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/include/foreign/fdwapi.h#L24-L55) — callback boundary.
- [Structured evidence](../data/evidence/hv00n.json) — bounded source scan.
