Skip to content

HV00B — fdw_invalid_handle

PostgreSQL SQLSTATE HV00B identifies an invalid handle at an FDW or SQL/MED boundary. The actual handle owner and lifecycle must come from the installed wrapper.

HV00B — fdw_invalid_handle

At a glance

HV00B names an invalid FDW handle: a wrapper received a handle that is unknown, closed, or invalid for the current operation. The PostgreSQL 18.6 core/contrib call scan has no resolved direct HV00B report group, so the handle type and message are implementation-specific.

Field Value
SQLSTATE HV00B
Condition fdw_invalid_handle
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_INVALID_HANDLE
Aliases

Meaning

SQL/MED uses “handle” for an implementation-owned reference, not a PostgreSQL relation OID or a SQL transaction ID. A wrapper might use one for a remote connection, cursor, reply, or execution object; these are possible examples, not an established emitter path in this batch. The class definition alone does not identify which one.

Messages and diagnostics

No direct 18.6 core/contrib message variant was resolved. Record the wrapper name/version, handle kind and lifetime, callback phase, foreign server/table, and the complete diagnostic. A remote server’s connection failure may be a different SQLSTATE.

Diagnosis

Trace creation, transfer, reuse, and close of the handle in the wrapper source. Check whether a scan or modification callback outlived a connection, whether a callback ran after cleanup, and whether the wrapper’s ABI matches the server. Do not infer that a NULL SQL value is an invalid handle.

Response

Repair the wrapper’s handle lifecycle or recreate the wrapper-owned connection/object according to its API. If the wrapper cannot establish whether a write completed, inspect remote logs before repeating it. An unchanged request is unlikely to repair a stale or closed handle.

Versions

HV00B is present from 9.1.0 through 18.6 and in 19 Beta 3. The available pre-9 definition scan did not observe it; this is a history boundary, not an exact introduction claim.

HV00K concerns a reply handle; HV009 concerns invalid null-pointer use; HV00N concerns establishing a connection.

Sources