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

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

Wiki / SQLSTATE

38000 — external_routine_exception

外部例程异常的类别码,覆盖外部命令与 PL 处理器。

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

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

aliases
未知
class name
External Routine Exception
condition name
external_routine_exception
lang
en
sqlstate
38000

版本定义 PG 18

38000

速览 {#at-a-glance}

SQLSTATE 38000 是外部例程异常类别。固定的 PostgreSQL 18.6 路径覆盖外部命令、UUID 库和 PL 语言处理器;这些实现必须按各自边界分别诊断。

含义 {#meaning}

代表性消息包括 program "%s" failed 和 shell command "%s" failed,二者都带内部 wait-status detail;UUID 路径还会报告 OSSP uuid library failure: %s、OSSP uuid library failure: error code %d、uuid library failure: %d 或 UUID 版本不匹配;PL/Perl 有 didn't get a return item from function 等报文,PL/Python 会转发带可选 detail/context/hint 的 %s,PL/Tcl 则有 could not parse function return value: %s 或带上下文的 %s。应保留动态字段和实际产生者;这个类别没有一条固定消息。

消息 {#messages}

代表性消息包括 program "%s" failed 和 shell command "%s" failed,二者都带内部 wait-status detail;UUID 路径还会报告 OSSP uuid library failure: %s、OSSP uuid library failure: error code %d、uuid library failure: %d 或 UUID 版本不匹配;PL/Perl 有 didn't get a return item from function 等报文,PL/Python 会转发带可选 detail/context/hint 的 %s,PL/Tcl 则有 could not parse function return value: %s 或带上下文的 %s。应保留动态字段和实际产生者;这个类别没有一条固定消息。

诊断 {#diagnosis}

根据消息和 context 确认外部边界:程序路径及等待结果、UUID 库操作,还是 PL 语言和例程。检查相关服务器配置和处理器日志,保留动态 %s 值及内部 detail。

处理 {#response}

修复消息点名的外部命令、库或语言例程,并独立验证该边界。外部动作失败时可能已经产生副作用;在确认完成状态和幂等性前不要重放。

版本 {#versions}

锁定目录将该条件的已知下界记为 PostgreSQL 7.4;事实块列出已发布快照,源码路径状态仅限于下方固定的 PostgreSQL 18.6 资料。

相关 {#related}

38001, 2F000

来源 {#sources}

可直接阅读固定的 basebackup_to_shell.c、copyto.c、uuid-ossp.c、plperl.c 和 pltcl.c 路径;完整范围和未解决的运行边界见结构化证据记录。

比较版本

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

claims · identity
{
  "claim_id": "identity",
  "limits": "",
  "method": "Read the fixed errcodes definition row, severity, and macro.",
  "position": 0,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "38000 is external_routine_exception in SQLSTATE Class 38."
}
claims · resolved-path
{
  "claim_id": "resolved-path",
  "limits": "Source confirmation is not a runtime observation in this batch.",
  "method": "Read the complete source context around the resolved report groups.",
  "position": 1,
  "runtime": [],
  "sources": [
    "src.path.0",
    "src.path.1",
    "src.path.2",
    "src.path.3",
    "src.path.4",
    "src.path.5",
    "src.path.6"
  ],
  "statement": "The fixed PostgreSQL 18.6 source contains the external-command, UUID-library, and PL/Perl, PL/Python, PL/Tcl report contexts and message variants described on the page."
}
claims · history-boundary
{
  "claim_id": "history-boundary",
  "limits": "Definition presence is not an emitting-path observation.",
  "method": "Compare canonical release facts with the available history boundary.",
  "position": 2,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "Locked release definitions establish catalogue presence from 7.4; they do not establish a precise introducing release or runtime use."
}
messages · message.basebackup-shell-failed
{
  "limits": "The command and internal wait-status detail are dynamic.",
  "message_id": "message.basebackup-shell-failed",
  "path": "",
  "position": 0,
  "raw": {
    "detail_template": "%s",
    "id": "message.basebackup-shell-failed",
    "limits": "The command and internal wait-status detail are dynamic.",
    "primary_template": "shell command \"%s\" failed",
    "severity_source": "ERROR",
    "sources": [
      "src.path.0"
    ],
    "sqlstate": "38000"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.0"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "shell command \" \" failed",
      "position": 0,
      "role": "",
      "template": "shell command \"%s\" failed"
    },
    {
      "kind": "detail",
      "literal": "",
      "position": 1,
      "role": "",
      "template": "%s"
    }
  ]
}
messages · message.copy-program-failed
{
  "limits": "The program path and internal wait-status detail are dynamic.",
  "message_id": "message.copy-program-failed",
  "path": "",
  "position": 1,
  "raw": {
    "detail_template": "%s",
    "id": "message.copy-program-failed",
    "limits": "The program path and internal wait-status detail are dynamic.",
    "primary_template": "program \"%s\" failed",
    "severity_source": "ERROR",
    "sources": [
      "src.path.1",
      "src.path.4"
    ],
    "sqlstate": "38000"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.1",
    "src.path.4"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "program \" \" failed",
      "position": 0,
      "role": "",
      "template": "program \"%s\" failed"
    },
    {
      "kind": "detail",
      "literal": "",
      "position": 1,
      "role": "",
      "template": "%s"
    }
  ]
}
messages · message.uuid-library-text
{
  "limits": "The external UUID library text is interpolated into the primary message.",
  "message_id": "message.uuid-library-text",
  "path": "",
  "position": 2,
  "raw": {
    "id": "message.uuid-library-text",
    "limits": "The external UUID library text is interpolated into the primary message.",
    "primary_template": "OSSP uuid library failure: %s",
    "severity_source": "ERROR",
    "sources": [
      "src.path.2"
    ],
    "sqlstate": "38000"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.2"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "OSSP uuid library failure:",
      "position": 0,
      "role": "",
      "template": "OSSP uuid library failure: %s"
    }
  ]
}
messages · message.uuid-library-code
{
  "limits": "The external UUID status code is dynamic.",
  "message_id": "message.uuid-library-code",
  "path": "",
  "position": 3,
  "raw": {
    "id": "message.uuid-library-code",
    "limits": "The external UUID status code is dynamic.",
    "primary_template": "OSSP uuid library failure: error code %d",
    "severity_source": "ERROR",
    "sources": [
      "src.path.2"
    ],
    "sqlstate": "38000"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.2"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "OSSP uuid library failure: error code",
      "position": 0,
      "role": "",
      "template": "OSSP uuid library failure: error code %d"
    }
  ]
}
messages · message.uuid-library-code-short
{
  "limits": "The UUID library status value is dynamic; this branch is used by the uuid-ossp fallback path.",
  "message_id": "message.uuid-library-code-short",
  "path": "",
  "position": 4,
  "raw": {
    "id": "message.uuid-library-code-short",
    "limits": "The UUID library status value is dynamic; this branch is used by the uuid-ossp fallback path.",
    "primary_template": "uuid library failure: %d",
    "severity_source": "ERROR",
    "sources": [
      "src.path.2"
    ],
    "sqlstate": "38000"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.2"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "uuid library failure:",
      "position": 0,
      "role": "",
      "template": "uuid library failure: %d"
    }
  ]
}
messages · message.uuid-version-mismatch
{
  "limits": "The UUID version character is dynamic.",
  "message_id": "message.uuid-version-mismatch",
  "path": "",
  "position": 5,
  "raw": {
    "id": "message.uuid-version-mismatch",
    "limits": "The UUID version character is dynamic.",
    "primary_template": "uuid_create() produced a version %c UUID instead of the expected version 1",
    "severity_source": "ERROR",
    "sources": [
      "src.path.2"
    ],
    "sqlstate": "38000"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.2"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "uuid_create() produced a version UUID instead of the expected version 1",
      "position": 0,
      "role": "",
      "template": "uuid_create() produced a version %c UUID instead of the expected version 1"
    }
  ]
}
messages · message.plperl-no-return-item
{
  "limits": "",
  "message_id": "message.plperl-no-return-item",
  "path": "",
  "position": 6,
  "raw": {
    "id": "message.plperl-no-return-item",
    "primary_template": "didn't get a return item from function",
    "severity_source": "ERROR",
    "sources": [
      "src.path.5"
    ],
    "sqlstate": "38000"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.5"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "didn't get a return item from function",
      "position": 0,
      "role": "",
      "template": "didn't get a return item from function"
    }
  ]
}
messages · message.plpython-forwarded-diagnostics
{
  "limits": "PL/Python forwards the underlying dynamic message and optional DETAIL, CONTEXT, and HINT; no single static primary template is asserted.",
  "message_id": "message.plpython-forwarded-diagnostics",
  "path": "",
  "position": 7,
  "raw": {
    "dynamic_format": "errmsg_internal %s; errdetail_internal %s; errcontext %s; errhint %s",
    "id": "message.plpython-forwarded-diagnostics",
    "limits": "PL/Python forwards the underlying dynamic message and optional DETAIL, CONTEXT, and HINT; no single static primary template is asserted.",
    "primary_template": null,
    "severity_source": "caller-selected level",
    "sources": [
      "src.path.3"
    ],
    "sqlstate": "38000"
  },
  "severity": "caller-selected level",
  "sources": [
    "src.path.3"
  ],
  "templates": []
}
messages · message.pltcl-return-parse
{
  "limits": "The parse error text is dynamic.",
  "message_id": "message.pltcl-return-parse",
  "path": "",
  "position": 8,
  "raw": {
    "id": "message.pltcl-return-parse",
    "limits": "The parse error text is dynamic.",
    "primary_template": "could not parse function return value: %s",
    "severity_source": "ERROR",
    "sources": [
      "src.path.6"
    ],
    "sqlstate": "38000"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.6"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "could not parse function return value:",
      "position": 0,
      "role": "",
      "template": "could not parse function return value: %s"
    }
  ]
}
messages · message.pltcl-context
{
  "limits": "Both error text and function name are dynamic.",
  "message_id": "message.pltcl-context",
  "path": "",
  "position": 9,
  "raw": {
    "context_template": "%s\nin PL/Tcl function %s",
    "id": "message.pltcl-context",
    "limits": "Both error text and function name are dynamic.",
    "primary_template": "%s",
    "severity_source": "ERROR",
    "sources": [
      "src.path.6"
    ],
    "sqlstate": "38000"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.6"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "",
      "position": 0,
      "role": "",
      "template": "%s"
    },
    {
      "kind": "context",
      "literal": "in PL/Tcl function",
      "position": 1,
      "role": "",
      "template": "%s\nin PL/Tcl function %s"
    }
  ]
}
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#L300"
}
sources · src.path.0
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "contrib/basebackup_to_shell/basebackup_to_shell.c",
  "position": 1,
  "sha256": "4f42cb76243182416e6c4ca50029ab82c794d297ae36759f57511f18ff110b43",
  "source_id": "src.path.0",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/basebackup_to_shell/basebackup_to_shell.c#L239"
}
sources · src.path.1
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/commands/copyfrom.c",
  "position": 2,
  "sha256": "2eacfb8e896414428a8d124921fdc38629afe55c391c0fc16bce99b2db8bd86f",
  "source_id": "src.path.1",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/commands/copyfrom.c#L1966"
}
sources · src.path.2
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "contrib/uuid-ossp/uuid-ossp.c",
  "position": 3,
  "sha256": "b09f5fb48b28df9c279780181d2f3410e34a29904eba298b93ab9166aaa8a8e4",
  "source_id": "src.path.2",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/uuid-ossp/uuid-ossp.c#L387"
}
sources · src.path.3
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/pl/plpython/plpy_elog.c",
  "position": 4,
  "sha256": "707d4948e22451e4013abaf961e5dfd8b9573d709f5a47fb7e879587106cd8bf",
  "source_id": "src.path.3",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/pl/plpython/plpy_elog.c#L123"
}
sources · src.calls.REL_18_6
{
  "commit": "",
  "docs_url": "",
  "kind": "local_artifact",
  "location": "",
  "path": "raw/calls/REL_18_6.jsonl",
  "position": 5,
  "sha256": "9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf",
  "source_id": "src.calls.REL_18_6",
  "tag": "",
  "url": ""
}
sources · src.path.4
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/commands/copyto.c",
  "position": 6,
  "sha256": "f160930f5821d7320f3ac686f4edc4a7b341f84697ee5200eeff352f331c0bd5",
  "source_id": "src.path.4",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/commands/copyto.c#L575"
}
sources · src.path.5
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/pl/plperl/plperl.c",
  "position": 7,
  "sha256": "90789190fd0bf5b53773b57b8c3287c88c35fbebdfa8310acab3f2d89910e4ba",
  "source_id": "src.path.5",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/pl/plperl/plperl.c#L2250"
}
sources · src.path.6
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/pl/tcl/pltcl.c",
  "position": 8,
  "sha256": "cd9c06395a4bb6125bda553a6ecdeebdcc7922e6a12ddb84c98c0c3d1d39a172",
  "source_id": "src.path.6",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/pl/tcl/pltcl.c#L1036"
}

来源引用

完整定义与证据 JSON

定义来源

center · PostgreSQL 18 · english-manuals:1541096bc4abbd389339b87503cfd2d206c478730cad698bb9659796a041d5d3

正文语言: zh-Hans · english-manuals:1541096bc4abbd389339b87503cfd2d206c478730cad698bb9659796a041d5d3