↑↓ 选择↵ 打开⌫ 切换范围完整搜索

PG.CENTER 连接 PostgreSQL 文档、百科与生态知识。由 Pigsty 维护。

Wiki / SQLSTATE

HV001 — fdw_out_of_memory(外部数据包装器内存不足)

包装器分配内存失败,如获取 libpq 默认选项时。

英文手册覆盖始于 PostgreSQL 8.1. 来源历史与运行验证各自保留独立版本边界。

当前阅读 PG 18·选择有来源记录的版本

aliases
未知
class name
Foreign Data Wrapper Error (SQL/MED)
condition name
fdw_out_of_memory
lang
en
sqlstate
HV001

版本定义 PG 18

HV001 — fdw_out_of_memory(外部数据包装器内存不足)

速览 {#at-a-glance}

HV001 是 FDW 内存不足条件。PostgreSQL 18.6 的 postgres_fdw 和 dblink 在 PQconndefaults() 没有返回选项数组时使用它,postgres_fdw 复制选项的分配失败路径也使用它。固定源码报文是 out of memory,有些路径附带 Could not get libpq's default connection options.。它是 ERROR,远端操作是否已执行取决于阶段。

含义与触发路径 {#meaning}

postgres_fdw 在构建选项列表时调用 PQconndefaults();空结果被视为分配失败并报告 HV001。随后为复制选项分配内存失败时也使用该码。dblink 有两个对应的选项发现路径。这是包装器实现细节,不能把所有 HV001 都解释为后端全局耗尽内存。

报文与诊断 {#messages}

18.6 的已确认变体包括:dblink 1972–1974 和 2908–2910、postgres_fdw/option.c:317–319 的 ERROR: out of memory 加 detail;option.c:340–341 只有主报文。应同时保留函数阶段和包装器名称;该报文不是远端服务器响应。

诊断 {#diagnosis}

记录所有诊断字段,确认是在读取 FDW/服务器选项还是建立 dblink/postgres_fdw 连接时失败。检查后端内存压力、进程限制、包装器与 libpq 版本;detail 指向 libpq 默认选项时,先区分 PQconndefaults() 分配失败与 libpq 安装或配置问题,再把本地库路径/版本作为辅助证据,最后排查远端 SQL。

处理 {#response}

降低并发内存压力并检查后端进程或容器限制,理解分配失败后再重试选项发现。若服务器实际报告的是 53200,应按该代码的诊断处理;若已确认是 HV001,不能仅因发生分配失败就改标为 53200。写操作要结合回调阶段和远端日志确认是否已发命令;单独的 HV001 不是整事务重试信号。

版本 {#versions}

目录从 9.1.0 观察到该码,并延续到 18.6 与 19 Beta 3。上述 18.6 路径和大小写固定到 commit 724edf9bde9d356724ad384a2e196edc3c9f80f7;旧版本措辞可能不同。

相关 {#related}

HV000 是通用 FDW 条件;HV002 是缺少包装器参数;53200 是后端通用内存不足,只有确认后端而非 FDW 报错时才使用它。

来源 {#sources}

比较版本

SQLSTATE 证据与已记录的运行版本

claims · identity
{
  "claim_id": "identity",
  "limits": "",
  "method": "Read the fixed errcodes row and macro.",
  "position": 0,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "HV001 is fdw_out_of_memory in SQL/MED Class HV."
}
claims · postgres-fdw-options
{
  "claim_id": "postgres-fdw-options",
  "limits": "The source assumes allocation failure for PQconndefaults; it does not prove global backend memory exhaustion.",
  "method": "Read option.c lines 313-341 and its adjacent failure comments.",
  "position": 1,
  "runtime": [],
  "sources": [
    "src.postgres_fdw.option.18.6"
  ],
  "statement": "postgres_fdw reports HV001 when PQconndefaults returns null and when allocation of its copied option array fails."
}
claims · dblink-options
{
  "claim_id": "dblink-options",
  "limits": "dblink is a separate contrib client API, not an FDW callback implementation.",
  "method": "Read dblink.c lines 1968-1974 and 2904-2910.",
  "position": 2,
  "runtime": [],
  "sources": [
    "src.dblink.18.6"
  ],
  "statement": "dblink reports HV001 when PQconndefaults returns null in two connection-option paths."
}
messages · postgres_fdw_pqconndefaults
{
  "limits": "",
  "message_id": "postgres_fdw_pqconndefaults",
  "path": "contrib/postgres_fdw/option.c:317-319",
  "position": 0,
  "raw": {
    "detail": "Could not get libpq's default connection options.",
    "id": "postgres_fdw_pqconndefaults",
    "message": "out of memory",
    "path": "contrib/postgres_fdw/option.c:317-319",
    "severity": "ERROR",
    "source_ids": [
      "src.postgres_fdw.option.18.6"
    ],
    "sqlstate": "HV001"
  },
  "severity": "ERROR",
  "sources": [
    "src.postgres_fdw.option.18.6"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "out of memory",
      "position": 0,
      "role": "observed",
      "template": "out of memory"
    },
    {
      "kind": "detail",
      "literal": "Could not get libpq's default connection options.",
      "position": 1,
      "role": "observed",
      "template": "Could not get libpq's default connection options."
    }
  ]
}
messages · postgres_fdw_malloc
{
  "limits": "",
  "message_id": "postgres_fdw_malloc",
  "path": "contrib/postgres_fdw/option.c:340-341",
  "position": 1,
  "raw": {
    "id": "postgres_fdw_malloc",
    "message": "out of memory",
    "path": "contrib/postgres_fdw/option.c:340-341",
    "severity": "ERROR",
    "source_ids": [
      "src.postgres_fdw.option.18.6"
    ],
    "sqlstate": "HV001"
  },
  "severity": "ERROR",
  "sources": [
    "src.postgres_fdw.option.18.6"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "out of memory",
      "position": 0,
      "role": "observed",
      "template": "out of memory"
    }
  ]
}
messages · dblink_pqconndefaults
{
  "limits": "",
  "message_id": "dblink_pqconndefaults",
  "path": "contrib/dblink/dblink.c:1972-1974; 2908-2910",
  "position": 2,
  "raw": {
    "detail": "Could not get libpq's default connection options.",
    "id": "dblink_pqconndefaults",
    "message": "out of memory",
    "path": "contrib/dblink/dblink.c:1972-1974; 2908-2910",
    "severity": "ERROR",
    "source_ids": [
      "src.dblink.18.6"
    ],
    "sqlstate": "HV001"
  },
  "severity": "ERROR",
  "sources": [
    "src.dblink.18.6"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "out of memory",
      "position": 0,
      "role": "observed",
      "template": "out of memory"
    },
    {
      "kind": "detail",
      "literal": "Could not get libpq's default connection options.",
      "position": 1,
      "role": "observed",
      "template": "Could not get libpq's default connection options."
    }
  ]
}
sources · src.errcodes.18.6
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/utils/errcodes.txt",
  "position": 0,
  "sha256": "6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba",
  "source_id": "src.errcodes.18.6",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt"
}
sources · src.postgres_fdw.option.18.6
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "contrib/postgres_fdw/option.c",
  "position": 1,
  "sha256": "880fd16c3e5cbc56733d1292ffdcc9b0f6cb1e17e72c90e9afa4e359239dc314",
  "source_id": "src.postgres_fdw.option.18.6",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/postgres_fdw/option.c"
}
sources · src.dblink.18.6
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "contrib/dblink/dblink.c",
  "position": 2,
  "sha256": "e4cfaec3a0a1e5d23fded584725e0f6cf7a17321ad99e5fe046e8b7f97416f15",
  "source_id": "src.dblink.18.6",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/dblink/dblink.c"
}
sources · src.calls.REL_18_6
{
  "commit": "",
  "docs_url": "",
  "kind": "local_artifact",
  "location": "",
  "path": "raw/calls/REL_18_6.jsonl",
  "position": 3,
  "sha256": "9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf",
  "source_id": "src.calls.REL_18_6",
  "tag": "",
  "url": ""
}

来源引用

完整定义与证据 JSON

定义来源

center · PostgreSQL 18 · english-manuals:661c3d329f17aa7387ad938cf878cfc4b592648e79cdf748ea7b624fa018c236

正文语言: zh-Hans · english-manuals:661c3d329f17aa7387ad938cf878cfc4b592648e79cdf748ea7b624fa018c236