# HV00D — fdw_invalid_option_name

> PostgreSQL SQLSTATE HV00D 表示 FDW 实现不接受当前上下文中的选项名称；file_fdw 与 postgres_fdw 提供了具体消息和提示。
---

# HV00D — fdw_invalid_option_name

## 速览 {#at-a-glance}

当 FDW 选项名称不符合当前包装器上下文时，会产生 `HV00D`。PostgreSQL 18.6 在 `file_fdw`、`postgres_fdw` 以及 `postgres_fdw` 的导入选项解析器中都有直接路径。

<!-- BEGIN SQLSTATE FACTS: generated by scripts/generate.py; do not edit -->

| 字段 | 值 |
| --- | --- |
| SQLSTATE | `HV00D` |
| 条件名 | `fdw_invalid_option_name` |
| 状态 | `有效` |
| 已知存在于 | `9.1.0` |
| 锁定快照 | `9.1.24, 9.2.24, 9.3.25, 9.4.26, 9.5.25, 9.6.24, 10.23, 11.22, 12.22, 13.23, 14.24, 15.19, 16.15, 17.11, 18.6, 19beta3` |
| 宏 | `ERRCODE_FDW_INVALID_OPTION_NAME` |
| 别名 | `—` |

<!-- source facts: data/errcodes/HV00D.json -->
<!-- END SQLSTATE FACTS -->

## 含义与消息 {#meaning}

包装器会按当前上下文检查选项：可能是 FDW、服务器、外部表、用户映射或导入。18.6 的主消息模板是 `invalid option "%s"`。`file_fdw` 与 `postgres_fdw/option.c` 只有在找到足够相近名称时才提示 `Perhaps you meant the option "%s".`；若存在合法选项但没有相近候选，源码不发送 hint；只有不存在任何合法选项时才提示 `There are no valid options in this context.`。`postgres_fdw` 导入解析器只有主消息。

## 诊断 {#diagnosis}

记录正在修改的对象和包装器版本，然后查看该包装器的验证逻辑与选项表。确认选项属于服务器、外部表还是用户映射；同名选项可能只在其中一个范围有效。保留消息中的相近名称，不要套用其他包装器的选项表。

## 处理 {#response}

使用已安装包装器在该范围支持的名称，或删除不支持的选项。若选项来自较新的扩展，先确认版本差异确实是原因，再协调扩展与服务器版本。重复相同定义不会改变验证结果。

## 消息与诊断 {#messages}

18.6 的确认路径位于 `file_fdw`、`postgres_fdw` 选项验证器和 `postgres_fdw` 导入选项解析器，严重级别均为 `ERROR`。`%s` 代表动态选项名称或相近名称；提示会随匹配结果变化。

## 版本 {#versions}

`HV00D` 从 9.1.0 到 18.6 以及 19 Beta 3 均存在。固定的 REL9_6_24 `file_fdw` 与 `postgres_fdw` 验证器快照使用较早的 `Valid options in this context are: %s` 提示，而固定的 18.6 路径使用相近名称或无可用选项的提示。这两个快照只界定措辞范围，不能确定具体切换版本；比较日志时应以实际安装版本为准。

## 相关 {#related}

[`HV00C`](../hv00c/) 涉及选项索引；[`HV00J`](../hv00j/) 是 dblink 的选项名称未找到条件；[`HV00A`](../hv00a/) 涉及字符串格式而不是选项身份。

## 来源 {#sources}

- [`errcodes.txt`](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt#L472) — 定义，SHA-256 `6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba`。
- [file_fdw.c](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/file_fdw/file_fdw.c#L244-L253)、[postgres_fdw/option.c](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/postgres_fdw/option.c#L107-L116)、[postgres_fdw.c](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/postgres_fdw/postgres_fdw.c#L5488-L5493) — 18.6 选项验证器。
- [REL9_6_24 中的 file_fdw.c](https://github.com/postgres/postgres/blob/a4116b8d5a4f68803452d8f1aa3f74f302049a90/contrib/file_fdw/file_fdw.c#L240-L246) 与 [postgres_fdw/option.c](https://github.com/postgres/postgres/blob/a4116b8d5a4f68803452d8f1aa3f74f302049a90/contrib/postgres_fdw/option.c#L99-L103) — 有界历史提示比较；SHA-256 分别为 1745225d449f44e9b384e372e8e13d5f5fe141e53d49526760fc1df8a1bf6211 和 d7da1cf22cd61619ef2f0cb7ce1a741d4ecb9a03636766e097e2183acdf21d48。
- [结构化证据](../../data/evidence/hv00d.json) — 确认的消息角色和来源摘要。
