HV005ERRORTier 2 — Caution✅ HIGH confidenceFDW column name not found
What this means
SQLSTATE HV005 is raised when a foreign data wrapper cannot find a column name in the descriptor returned by the remote data source — the local foreign table definition references a column that does not exist in the remote table.
Why it happens
- 1The foreign table definition includes a column name that does not exist in the remote table or file
- 2Remote table schema changed and a column was renamed or dropped
How to reproduce
Foreign table referencing a non-existent remote column.
-- Foreign table defines column "email" but remote table has "email_address":
SELECT email FROM remote_users;Fix 1: Use the column_name option to map local to remote column names
When the local and remote column names differ.
ALTER FOREIGN TABLE remote_users
ALTER COLUMN email OPTIONS (SET column_name 'email_address');Why this works
The column_name option maps the local foreign table column name to the actual column name on the remote server.
Fix 2: Recreate the foreign table with the correct column names
When the remote schema has changed.
Why this works
Drop and recreate the foreign table using IMPORT FOREIGN SCHEMA or manually with the current remote column names.
Sources
📚 Official docs: https://www.postgresql.org/docs/current/errcodes-appendix.html
🔧 Source ref: Class HV — Foreign Data Wrapper Error
Confidence assessment
✅ HIGH confidence
Standard SQLSTATE for FDW column name mapping errors. Stable across versions.
See also
🔗 Related errors
📄 Reference pages