HV021
PostgreSQLERRORNotableForeign Data Wrapper ErrorHIGH confidence

fdw_inconsistent_descriptor_information

What this means

A foreign data wrapper detected inconsistent descriptor information, typically when the column count or types returned by the remote server do not match the expected descriptor.

Why it happens
  1. 1Remote table schema changed (column added/removed/retyped) after the foreign table was defined locally
  2. 2FDW descriptor built with different column count than actual remote result
  3. 3FDW implementation bug — descriptor not properly initialised
How to reproduce

Querying a foreign table whose remote schema has diverged from the local foreign table definition

trigger — this will error
trigger — this will error
SELECT * FROM my_foreign_table;  -- remote table had columns added/removed

expected output

ERROR:  HV021: fdw_inconsistent_descriptor_information

Fix

Redefine the foreign table to match the remote schema

WHEN Remote table schema changed

Redefine the foreign table to match the remote schema
DROP FOREIGN TABLE my_foreign_table;
IMPORT FOREIGN SCHEMA remote_schema LIMIT TO (my_table) FROM SERVER myserver INTO public;

Why this works

Recreates the foreign table definition to match the current remote schema

What not to do

Do not ALTER the remote table without updating the local foreign table definition

Schema drift causes descriptor mismatches

Sources
Official documentation ↗

https://www.postgresql.org/docs/current/errcodes-appendix.html

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All PostgreSQL errors