58000 — system_error
外部系统调用失败,如发送信号返回错误。
英文手册覆盖始于 PostgreSQL 8.1. 来源历史与运行验证各自保留独立版本边界。
当前阅读 PG 18·选择有来源记录的版本
- aliases
- 未知
- class name
- System Error (errors external to PostgreSQL itself)
- condition name
- system_error
- lang
- en
- sqlstate
- 58000
版本定义 PG 18
58000
速览 {#at-a-glance}
58000 是 system-error 条件。在固定 backend 路径中,pg_promote 创建 promotion signal 文件后调用 kill(PostmasterPid, SIGUSR1);信号发送失败时以 ERROR 报告,并把操作系统的 %m 文本展开到消息中。
含义 {#meaning}
代表性 backend primary 是 failed to send signal to postmaster: %m。代码在报告 ERROR 前先删除 promotion signal 文件,所以这里是 postmaster 通知路径中的系统调用失败,不是用户值或 SQL 语法错误。共享的 common/exec.c 使用 log_error 宏,并有两个编译时分支:非 FRONTEND 构建展开为 ereport(LOG, (errcodefn, errmsg_internal(...)));FRONTEND 构建忽略 errcode() 参数,把格式化文本写到 stderr。因此 frontend 工具消息不能证明存在客户端协议 58000 诊断,也不能证明客户端事务已回滚。common/logging.h 中独立的 pg_log_error 宏才映射到 PG_LOG_ERROR,但 pclose_check() 并不调用它。
消息 {#messages}
- backend
pg_promote信号路径:primary 为failed to send signal to postmaster: %m,severity 为 ERROR;展开文本取决于失败kill()调用当时的 OSerrno。 - 共享的
pclose_check()源码:调用点模板是%s() failed: %m;对pclose()会展开为pclose() failed: <OS 文本>。非 FRONTEND 构建经ereport(LOG)携带传入的ERRCODE_SYSTEM_ERROR;FRONTEND 构建忽略该 code、直接写 stderr,因此不是客户端协议58000路径。
诊断 {#diagnosis}
保留 %m 展开后的完整 primary、操作类型(promotion signal、pclose 或其他系统 helper)、进程身份及服务器或工具日志上下文。对 backend pg_promote,检查 postmaster PID、信号权限/进程存活状态和 OS 错误。没有实际 errno 时,不要把系统错误替换成笼统的磁盘、权限或进程诊断;单凭 SQLSTATE 也不能判断事务结果。
处理 {#response}
先修正展开消息所指出的操作系统条件,再确认 postmaster/服务器健康后重试。backend ERROR 通常会使当前显式事务进入错误状态,继续前先执行 ROLLBACK 或 ROLLBACK TO SAVEPOINT;autocommit 下也应在原因修正后再重试。pclose_check 的 frontend 日志由工具自身控制流处理,不应据此要求 SQL 回滚。若连接已断开,待服务器 ready 后重连并核对业务效果。
版本 {#versions}
锁定目录从 9.2.0 记录此条件;该目录边界不等于精确实现引入版本。固定源码覆盖 PostgreSQL 18.6。
相关 {#related}
来源 {#sources}
src/backend/access/transam/xlogfuncs.c#L702-708
src/include/common/logging.h#L106-110
结构化证据记录保存 backend 与 frontend/common 消息边界。
比较版本
SQLSTATE 证据与已记录的运行版本
claims · identity
{
"claim_id": "identity",
"limits": "",
"method": "Read fixed definition.",
"position": 0,
"runtime": [],
"sources": [
"src.errcodes.18.6"
],
"statement": "58000 is system_error in SQLSTATE Class 58."
}claims · resolved-paths
{
"claim_id": "resolved-paths",
"limits": "Source confirmation is not natural runtime.",
"method": "Read the complete backend call site, common exec macro definition/call site, and logging macro definitions.",
"position": 1,
"runtime": [],
"sources": [
"src.path.0",
"src.path.1",
"src.path.2",
"src.path.3"
],
"statement": "The fixed backend pg_promote path reports ERROR with ERRCODE_SYSTEM_ERROR; the shared pclose_check source has separate non-FRONTEND ereport(LOG) and FRONTEND stderr macro branches, so frontend output is not asserted as a client-protocol 58000 response."
}claims · history
{
"claim_id": "history",
"limits": "",
"method": "Use catalogue boundary.",
"position": 2,
"runtime": [],
"sources": [
"src.errcodes.18.6"
],
"statement": "The locked catalogue records 58000 from 9.2.0; that boundary does not prove exact implementation introduction."
}messages · message.0
{
"limits": "",
"message_id": "message.0",
"path": "",
"position": 0,
"raw": {
"id": "message.0",
"primary_template": "failed to send signal to postmaster: %m",
"severity_source": "ERROR",
"sources": [
"src.path.0"
],
"sqlstate": "58000"
},
"severity": "ERROR",
"sources": [
"src.path.0"
],
"templates": [
{
"kind": "primary",
"literal": "failed to send signal to postmaster:",
"position": 0,
"role": "",
"template": "failed to send signal to postmaster: %m"
}
]
}messages · message.1
{
"limits": "",
"message_id": "message.1",
"path": "",
"position": 1,
"raw": {
"id": "message.1",
"primary_template": "%s() failed: %m",
"severity_source": "non-FRONTEND: ereport(LOG) with ERRCODE_SYSTEM_ERROR; FRONTEND: log_error ignores errcodefn and prints to stderr (no backend SQLSTATE protocol)",
"sources": [
"src.path.1",
"src.path.3"
],
"sqlstate": "58000"
},
"severity": "non-FRONTEND: ereport(LOG) with ERRCODE_SYSTEM_ERROR; FRONTEND: log_error ignores errcodefn and prints to stderr (no backend SQLSTATE protocol)",
"sources": [
"src.path.1",
"src.path.3"
],
"templates": [
{
"kind": "primary",
"literal": "() failed:",
"position": 0,
"role": "",
"template": "%s() failed: %m"
}
]
}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#L444"
}sources · src.path.0
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/access/transam/xlogfuncs.c",
"position": 1,
"sha256": "6373dff222519c8544541eb120eb6e1f3c921d0b7bb2293689c4e5f98b9d41d0",
"source_id": "src.path.0",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/access/transam/xlogfuncs.c#L706"
}sources · src.path.1
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/common/exec.c",
"position": 2,
"sha256": "b39dfdb5574510a25441da87c413ea4c4df90188e5666c2d218345e05cc70831",
"source_id": "src.path.1",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/common/exec.c#L391"
}sources · src.path.2
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/include/common/logging.h",
"position": 3,
"sha256": "ca990bba3381d3810e5e031eb33658e1d48a3654f2cbae3ae5e3c9d4c727b787",
"source_id": "src.path.2",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/include/common/logging.h#L106"
}sources · src.path.3
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/common/exec.c",
"position": 4,
"sha256": "b39dfdb5574510a25441da87c413ea4c4df90188e5666c2d218345e05cc70831",
"source_id": "src.path.3",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/common/exec.c#L52"
}来源引用
定义来源
center · PostgreSQL 18 · english-manuals:96baad059338afd65de693238551af02f13c0355a81ed17625d1c6a7826eb639
正文语言: zh-Hans · english-manuals:96baad059338afd65de693238551af02f13c0355a81ed17625d1c6a7826eb639