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

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

百科 / 错误代码 / Class 0P 无效角色规范

0P000 invalid_role_specification

角色规范无效

ERROR 源码确认 参考 未实测

类别
Class 0P 无效角色规范
严重等级
ERROR
条件名
invalid_role_specification
宏名称
ERRCODE_INVALID_ROLE_SPECIFICATION
启用版本
7.4
状态
活跃

版本覆盖

速览

SQLSTATE 0P000 是 Class 0P 中的 invalid_role_specification。在 ENABLE_SSPI 下,固定的 Windows SSPI 路径在把 SAM 账户名转换为 UPN 时以服务器 LOG 分支使用它;它不是普通的“角色不存在”登录结果,也不是客户端 ErrorResponse。

含义

0P000invalid_role_specification。固定的 pg_SSPI_make_upn 路径构造 DOMAIN\user,调用 Windows TranslateName 得到 user@realm;转换失败、结果没有 @,或 realm/账户无法放入目标缓冲区时记录 0P000。这些是 ENABLE_SSPI 下的服务器 LOG 分支,不是客户端 ErrorResponse,也不是普通角色缺失结果。

诊断

确认失败路径确实是 Windows SSPI,并结合服务器日志检查 SAM 账户/域名及配置的 realm 或 UPN 映射。TranslateName 失败(包括结果不含 @)记录 could not translate name;realm 过长记录 realm name too long;转换后的账户过长记录 translated account name too long。使用 trust 认证的临时实例无法忠实演示这一外部身份边界;启动 ErrorResponse 也可能是 28000 或 28P01。

处理

修复 SSPI 账户/realm 映射或 Windows 名称转换配置后建立新连接。应把这些服务器日志诊断与启动认证响应、SQL 角色不存在和密码失败分开。

可复现案例

在一次性实例上执行过的场景。

source_boundary PG 10 / 18

前置条件

  • A runner-owned disposable target is provisioned only if a source-boundary smoke run is requested.

触发

No artificial SQL trigger is executed; this record preserves the fixed source/definition boundary.

处置

Use the concrete source path or component-specific documentation when it applies.

清理

Drop the case schema with an owner connection.

报文

固定 SSPI 源码以 LOG 和 SQLSTATE 0P000 记录以下主报文模板:could not translate namerealm name too longtranslated account name too long。这些是服务器日志记录;只有客户端异常或没有匹配服务器日志的启动 ErrorResponse,都不能证明 0P000

报文模板

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

主消息 realm name too long

来源:src/backend/libpq/auth.c @ REL_10_23

主消息 translated account name too long

来源:src/backend/libpq/auth.c @ REL_10_23

代表案例

本页没有选定的自然 SQL 运行。结构化证据记录的是源码或定义边界;客户端 RAISE 不能代表服务器机制。

版本

上面的生成事实表记录锁定的目录快照和最早观察到的定义。本页没有选定的自然 SQL 运行;固定 REL_18_6/REL_10_23 的 SSPI 源码比较不能当作实测结果,也不能据此推断所有中间版本的行为。

来源

证据

断言

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

  • 0P000 is the invalid_role_specification condition in Class 0P.

    核实方式Read the fixed errcodes.txt definition and the locked catalogue metadata.

    不覆盖Directory identity does not identify every backend or client path.

    来源src/backend/utils/errcodes.txt

  • Under ENABLE_SSPI, the fixed pg_SSPI_make_upn path builds a DOMAIN\user SAM name, calls Windows TranslateName to obtain a user@realm UPN, and logs 0P000 when translation fails, the result has no @, or the realm or translated account exceeds its target buffer. These are server LOG branches, not client ErrorResponse fields.

    核实方式Read the complete fixed SSPI authentication and pg_SSPI_make_upn paths in REL_18_6 and REL_10_23, including each explicit LOG branch.

    不覆盖This is a bounded source claim under ENABLE_SSPI; the disposable trust target cannot faithfully exercise it, and it is not an observed natural SQLSTATE case.

    来源src/backend/libpq/auth.c · src/backend/libpq/auth.c · src/backend/libpq/auth.c

  • The locked catalogue records 0P000 in the listed snapshots; this page compares only the fixed REL_18_6 and REL_10_23 SSPI source paths and has no selected natural runtime.

    核实方式Read the generated facts block and fixed SSPI source records; no runtime result is used for this source-only page.

    不覆盖Presence in a definition file is not an exact behavioral introduction, and the fixed source paths do not prove every intermediate release or authentication configuration.

    来源src/backend/utils/errcodes.txt · src/backend/libpq/auth.c · src/backend/libpq/auth.c