Skip to content

HV008 — fdw_invalid_column_number

PostgreSQL SQLSTATE HV008 denotes an invalid foreign-column ordinal. Inspect the wrapper descriptor and local-to-remote column mapping.

HV008 — fdw_invalid_column_number

At a glance

HV008 identifies an invalid column number (ordinal) in an FDW descriptor or callback. PostgreSQL 18.6 defines it, but its core/contrib call scan found no direct report group or bundled message.

Field Value
SQLSTATE HV008
Condition fdw_invalid_column_number
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_COLUMN_NUMBER
Aliases

Meaning

The wrapper received or produced an ordinal that is outside the descriptor it is using. This is a mapping/descriptor issue, not evidence that a user SQL column name is absent (HV005) or malformed (HV007).

Messages and diagnostics

No fixed core message is confirmed. Keep the ordinal, descriptor width, local relation identity, callback phase, and wrapper/remote metadata version.

Diagnosis

Compare the target list and pg_attribute.attnum values with the wrapper’s remote column array. Check dropped columns, projection rewrites, and schema changes between planning and execution. Read the installed wrapper source for the callback that indexes the descriptor.

Response

Refresh the foreign-table mapping or correct the wrapper’s ordinal translation, then plan the statement again. Do not mask the error by dropping arbitrary columns; the correct repair depends on which descriptor boundary supplied the invalid ordinal.

Versions

HV008 is observed in every locked formal snapshot beginning at 9.1.0 through 18.6 and in 19 Beta 3. It was not observed in the available pre-9 definition files.

HV005 concerns a missing name, HV007 an invalid name, and HV006 invalid type descriptor metadata.

Sources