# 08000 — connection_exception

> PostgreSQL SQLSTATE 08000: connection_exception, source-backed diagnosis and recovery guidance.
---

# 08000

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

SQLSTATE `08000` is **connection_exception** in Class `08`. Connection exception is a broad connection-management condition. In the fixed PostgreSQL paths it is used by `postgres_fdw` when an abort-cleanup failure makes a foreign-server connection unusable; a refused client socket is not enough to claim this code.

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

| Field | Value |
| --- | --- |
| SQLSTATE | `08000` |
| Condition | `connection_exception` |
| Status | `active` |
| Known present by | `7.4` |
| Locked snapshots | `9.0.23, 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_CONNECTION_EXCEPTION` |
| Aliases | `—` |

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

## Meaning {#meaning}

Connection exception is a broad connection-management condition. In the fixed PostgreSQL paths it is used by `postgres_fdw` when an abort-cleanup failure makes a foreign-server connection unusable; a refused client socket is not enough to claim this code.

## Diagnosis {#diagnosis}

Inspect the server log and the foreign server name, backend PID, transaction outcome, and FDW cleanup path. Compare the message with 08001 (a connection could not be established) and 08006 (an established connection failed). A client library can expose a different exception or no SQLSTATE.

## Response {#response}

Repair the foreign connection or its cleanup condition, finish the failed transaction according to the exact path, and retry the complete safe unit only after the remote outcome is known. Do not relabel a generic network exception as 08000.

## Messages {#messages}

The fixed `postgres_fdw` branch emits `ERROR` with primary `connection to server "%s" cannot be used due to abort cleanup failure`; the foreign server name is dynamic. This source-backed variant is narrower than a generic client socket refusal.

## Representative case {#case}

This page has no selected natural SQL run. The structured evidence records a source or definition boundary; a client-side `RAISE` would not represent a backend mechanism.

## Versions {#versions}

The generated facts table records the locked catalogue snapshots and earliest observed definition. This page has no selected natural SQL run; its fixed REL_18_6/REL_10_23 source boundary must not be read as an observed runtime result or as a claim about every intermediate release.

## Related {#related}

- [`08001` — sqlclient_unable_to_establish_sqlconnection](../08001/)
- [`08006` — connection_failure](../08006/)
- [`08007` — transaction_resolution_unknown](../08007/)

## Sources {#sources}

- `src.fdw-connection.18.6` — `contrib/postgres_fdw/connection.c` at `REL_18_6` commit `724edf9bde9d356724ad384a2e196edc3c9f80f7`; fixed blob SHA-256 `67fc002657f2c7df6d93cbf99c933cbc103907d1857ed77aedbb85099ea4dda0` ([source](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/postgres_fdw/connection.c#L1369-L1372)).
- `src.fdw-connection.10.23` — `contrib/postgres_fdw/connection.c` at `REL_10_23` commit `02991e79f8f58bc208f05dcc8af0c62dbe0a6ea4`; fixed blob SHA-256 `8a8b053e4ef599d95d0709744aa1dd5bb20047af9dc29b3f42cfba5785e525c5` ([source](https://github.com/postgres/postgres/blob/02991e79f8f58bc208f05dcc8af0c62dbe0a6ea4/contrib/postgres_fdw/connection.c#L1033-L1036)).
- `src.calls.REL_18_6` / `src.calls.REL_10_23` — fixed local call scans, SHA-256 `9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf` / `00d16d3eb01b71ccf1b245c8f3102f9d0ec9f36fb02777b8dd1b99fcb263040c`; these scans preserve the resolved call context used by the claims.
