HV00Q
Read PG 18 manual ↗fdw_schema_not_found
- SQLSTATE
- HV00Q
- Condition name
- fdw_schema_not_found
- Class
- Foreign Data Wrapper Error (SQL/MED)
- Source macro
- ERRCODE_FDW_SCHEMA_NOT_FOUND
- Evidence
- Source path confirmed
English SQLSTATE atlas: authored explanations and source/runtime evidence are separate from the manual definitions. View source ↗
At a glance
HV00Q is a concrete postgres_fdw import error. Its remote connection runs an exact pg_catalog.pg_namespace lookup for the requested nspname; when the result count is not exactly one, the wrapper reports the remote schema by name.
Meaning and message
In postgres_fdw.c:5515-5526, the import path sends SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname = ... on the mapped remote connection, checks PQntuples(res) != 1, and raises ERROR: schema "%s" is not present on foreign server "%s". The requested remote schema and server name are dynamic fields. The fixed query does not use the local search_path; a connection/query failure is handled earlier, while later remote privileges are a separate import concern.
Diagnosis
Check the IMPORT FOREIGN SCHEMA source name, remote database, mapped user, and the exact postgres_fdw server options. Confirm the mapped remote connection can run the fixed pg_catalog.pg_namespace lookup for the exact name; do not diagnose this branch from the local search_path. Distinguish a zero-or-unexpected-row result from a connection/query error reported earlier, and check remote schema/table privileges separately when the import proceeds.
Response
Use the remote schema's exact name, create it remotely if appropriate, or import from the correct foreign server/database. In autocommit, rerun only after the remote catalog state or mapping is corrected. Inside an explicit transaction, an ERROR leaves the local transaction failed; issue ROLLBACK, or ROLLBACK TO a previously established and still usable SAVEPOINT, before retrying the corrected import. Do not replay the command inside an INERROR transaction.
Messages and diagnostics
The fixed call group is severity ERROR, primary message schema "%s" is not present on foreign server "%s", with no detail or hint. Keep the remote schema/server values and wrapper version.
Versions
HV00Q is present from 9.1.0 through 18.6 and 19 Beta 3. Older wording or catalog-query details may vary; the 18.6 path is fixed to commit 724edf9bde9d356724ad384a2e196edc3c9f80f7.
Sources
errcodes.txt— definition, SHA-2566e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba.postgres_fdw.c— remotepg_namespacequery, result check, and message.- Transaction and savepoint recovery — the explicit-transaction recovery boundary; fixed
xact.sgmlSHA-256b48fbe8bd02ce3d1181a350c88c8baa6e11c73edc90a936e77b180daef328c5c. - Structured evidence — source path and message grouping.
Source evidence
Evidence belongs to the frozen source and runtime versions listed here. It is not a runtime verification of the selected manual version.
HV00Q is fdw_schema_not_found in SQL/MED Class HV.
Method: Read the fixed definition row and macro.
postgres_fdw runs SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname = <remote_schema> on the remote connection and emits HV00Q when that query does not return exactly one row.
Method: Read the fixed remote pg_namespace query and PQntuples result check.
Limits: The check uses the mapped remote connection and an exact nspname comparison; local search_path does not choose the schema. Connection or remote query errors are reported by an earlier path, and later schema/table privileges are separate from this existence check.
This source path reports ERROR; in an explicit local transaction, the caller must roll back the failed transaction or roll back to a deliberately established savepoint before sending another command.
Method: Combine the fixed ERROR severity with the PostgreSQL transaction and savepoint recovery documentation.
Limits: No natural postgres_fdw runtime was run in this batch; the transaction guidance is the general ERROR boundary, not a claim about a selected remote topology.
- src/backend/utils/errcodes.txt · REL_18_6 ·
724edf9bde9d356724ad384a2e196edc3c9f80f7 - contrib/postgres_fdw/postgres_fdw.c · REL_18_6 ·
724edf9bde9d356724ad384a2e196edc3c9f80f7 - doc/src/sgml/xact.sgml · PG18-docs ·
724edf9bde9d356724ad384a2e196edc3c9f80f7 raw/calls/REL_18_6.jsonl· ·
Message templates
ERROR · contrib/postgres_fdw/postgres_fdw.c:5523-5526
Primary
schema "%s" is not present on foreign server "%s"
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
- PG 9.0 → 9.1added
Definition snapshot: english-manuals:53774c2bae28086de2ca0c7d961… · English manual source