选择 打开 改范围 完整检索页

pgsql.cc 提供对 postgresql.org 官网内容的中文翻译,由 Pigsty 团队维护。

百科 / 错误代码 / Class HV 外部数据包装器错误

HV00Q fdw_schema_not_found

ERROR 源码确认 参考 未实测

类别
Class HV 外部数据包装器错误
严重等级
ERROR
条件名
fdw_schema_not_found
宏名称
ERRCODE_FDW_SCHEMA_NOT_FOUND
启用版本
9.1
状态
活跃

版本覆盖

速览

HV00Q 是具体的 postgres_fdw 导入错误。远端连接会按请求的 nspname 精确查询 pg_catalog.pg_namespace;结果行数不是恰好一行时,包装器按名称报告远端模式不存在。

含义与消息

postgres_fdw.c:5515-5526 的导入路径在映射的远端连接上发送 SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname = ...,检查 PQntuples(res) != 1,再报告 ERROR: schema "%s" is not present on foreign server "%s"。请求的远端模式和服务器名称都是动态字段。这个固定查询不使用本地 search_path;连接或查询错误会在更早路径报告,后续远端权限则是导入成功后的另一项检查。

诊断

检查 IMPORT FOREIGN SCHEMA 的源名称、远端数据库、映射用户和 postgres_fdw 服务器选项。确认映射的远端连接能按精确名称执行固定的 pg_catalog.pg_namespace 查询;不要用本地 search_path 推断这一分支。将零行或异常行数与更早发生的连接/查询错误区分开,并在导入继续后另行检查远端模式和表权限。

处理

使用远端模式的确切名称,在适当时创建远端模式,或改用正确的外部服务器和数据库。自动提交时,只有远端目录状态或用户映射修正后才重新导入。显式事务中的 ERROR 会使本地事务失败;重试修正后的导入前,先执行 ROLLBACK,或回滚到此前已经建立且仍可用的保存点,不要在 INERROR 事务中重放命令。

消息与诊断

确认的调用组严重级别为 ERROR,主消息是 schema "%s" is not present on foreign server "%s",没有 detail 或 hint。保留远端模式和服务器值,以及包装器版本。

报文模板

源码里的格式串,不是某一次运行的输出。%s 之类是占位符,实际报文会填入对象名与取值。适用范围一栏是核验时留下的原始英文记录,未经翻译。

主消息 · observed schema "%s" is not present on foreign server "%s"

来源:contrib/postgres_fdw/postgres_fdw.c @ REL_18_6

版本

HV00Q 从 9.1.0 到 18.6 以及 19 Beta 3 均存在。旧版本的措辞或目录查询细节可能不同;18.6 路径固定于指定提交。

来源

证据

断言

每条断言都写明了是怎么核实的,以及它不覆盖什么。这一层是核验时留下的原始英文记录,照原样呈现,未经翻译。

  • HV00Q is fdw_schema_not_found in SQL/MED Class HV.

    核实方式Read the fixed definition row and macro.

    来源src/backend/utils/errcodes.txt

  • 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.

    核实方式Read the fixed remote pg_namespace query and PQntuples result check.

    不覆盖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.

    来源contrib/postgres_fdw/postgres_fdw.c

  • 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.

    核实方式Combine the fixed ERROR severity with the PostgreSQL transaction and savepoint recovery documentation.

    不覆盖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.

    来源contrib/postgres_fdw/postgres_fdw.c · doc/src/sgml/xact.sgml

同类错误代码

Class HV 外部数据包装器错误 下的其他成员。