select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

SQLSTATE / CLASS HV · FOREIGN DATA WRAPPER ERROR (SQL/MED)

fdw_out_of_memory

SQLSTATE
HV001
Condition name
fdw_out_of_memory
Class
Foreign Data Wrapper Error (SQL/MED)
Source macro
ERRCODE_FDW_OUT_OF_MEMORY
Evidence
Source path confirmed
Analysis & operational context

English SQLSTATE atlas: authored explanations and source/runtime evidence are separate from the manual definitions. View source ↗

<h1>HV001 — fdw_out_of_memory</h1>

At a glance

HV001 is the SQL/MED condition for an FDW-side out-of-memory failure. In PostgreSQL 18.6, the bundled postgres_fdw and dblink implementations use it when PQconndefaults() returns no option array, and postgres_fdw also uses it when its option copy cannot be allocated.

The fixed source messages are out of memory, optionally with detail Could not get libpq's default connection options. This is an ERROR; whether the remote operation ran is phase-specific.

Meaning and trigger paths

postgres_fdw calls PQconndefaults() while building its option list; a null result is treated as an allocation failure and reported with HV001. A later malloc for the copied options has the same code but only the primary message. dblink has two corresponding option-discovery paths. These are wrapper implementation details, not proof that every HV001 means the backend allocator exhausted all memory.

Messages and diagnostics

The 18.6 source variants are:

  • ERROR: out of memory, with detail Could not get libpq's default connection options. in contrib/dblink/dblink.c:1972-1974, :2908-2910, and contrib/postgres_fdw/option.c:317-319.
  • ERROR: out of memory without detail in contrib/postgres_fdw/option.c:340-341.

Keep the function phase and wrapper name. The message is not a remote server response.

Diagnosis

Capture SQLSTATE and all fields, then identify whether failure occurred while reading FDW/server options or while establishing a dblink/postgres_fdw connection. Inspect backend memory pressure, process limits, and the wrapper/library versions. If the detail names libpq defaults, first distinguish a PQconndefaults() allocation failure from a libpq installation or configuration problem; check the local library path/version only as supporting evidence before debugging the remote SQL.

Response

Reduce concurrent memory pressure and check the backend process/container limits, then retry the same option-discovery operation only after the allocation failure is understood. If the server actually reports 53200, follow that SQLSTATE's diagnostic; do not relabel a confirmed HV001 merely because an allocation failed. For a write path, establish from the callback phase and remote logs whether any remote command was sent before retrying; HV001 alone is not a whole-transaction retry signal.

Versions

The catalogue first observes HV001 in 9.1.0 and retains it through 18.6 and 19 Beta 3. The 18.6 implementation paths and exact capitalization above are fixed to commit 724edf9bde9d356724ad384a2e196edc3c9f80f7; older variants may differ.

Sources

Source evidence

Evidence belongs to the frozen source and runtime versions listed here. It is not a runtime verification of the selected manual version.

HV001 is fdw_out_of_memory in SQL/MED Class HV.

Method: Read the fixed errcodes row and macro.

src.errcodes.18.6

postgres_fdw reports HV001 when PQconndefaults returns null and when allocation of its copied option array fails.

Method: Read option.c lines 313-341 and its adjacent failure comments.

Limits: The source assumes allocation failure for PQconndefaults; it does not prove global backend memory exhaustion.

src.postgres_fdw.option.18.6

Message templates

ERROR · contrib/postgres_fdw/option.c:317-319

Primary

out of memory

Detail

Could not get libpq's default connection options.
ERROR · contrib/postgres_fdw/option.c:340-341

Primary

out of memory
ERROR · contrib/dblink/dblink.c:1972-1974; 2908-2910

Primary

out of memory

Detail

Could not get libpq's default connection options.

Reproduction & repair cases

No reproduction case is attached to this condition.

Recorded runtime evidence

No runtime observation is attached to this entry.

Version history 1
  1. PG 9.0 → 9.1added

Definition snapshot: english-manuals:bf96fc95cde0c4e9c1d56837170… · English manual source