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

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

Wiki / SQLSTATE

39000 — external_routine_invocation_exception

外部例程调用异常,如 pgcrypto 的库失败。

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

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

aliases
未知
class name
External Routine Invocation Exception
condition name
external_routine_invocation_exception
lang
en
sqlstate
39000

版本定义 PG 18

39000

速览 {#at-a-glance}

SQLSTATE 39000 是外部例程调用异常类别。固定的 PostgreSQL 18.6 pgcrypto 路径会为加密库失败和输入长度无效报告该 ERROR;具体函数与动态错误文本决定诊断方向。

含义 {#meaning}

代表性消息包括 crypt(3) returned NULL、encrypt error: %s、decrypt error: %s、encrypt_iv error: %s、decrypt_iv error: %s 和 Length not in range。多个主消息会直接插入 px_strerror(err) 返回的动态库文本;这里的动态内容属于主消息,不是独立的 DETAIL 字段。

消息 {#messages}

代表性消息包括 crypt(3) returned NULL、encrypt error: %s、decrypt error: %s、encrypt_iv error: %s、decrypt_iv error: %s 和 Length not in range。多个变体把 px_strerror(err) 返回的动态库文本直接放入主消息;它不是独立的 DETAIL 字段。

诊断 {#diagnosis}

确认 pgcrypto 函数和操作(crypt、加解密、IV 形式或长度校验)。保留动态错误字符串,检查输入长度、key/IV 参数和库边界;不要把库错误与远端例程的 SQLSTATE 合并。

处理 {#response}

修正点名的输入或库/配置问题,并验证同一 pgcrypto 操作。只有操作可安全重复且没有完成外部可见工作时才重试;加密调用失败不能成为重放外层写入的理由。

版本 {#versions}

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

相关 {#related}

39001, 2F000

来源 {#sources}

可直接阅读固定的 pgcrypto.c、pgp-cfb.c 和 px.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": "39000 is external_routine_invocation_exception in SQLSTATE Class 39."
}
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"
  ],
  "statement": "The fixed PostgreSQL 18.6 source contains the 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.pgcrypto-crypt-null
{
  "limits": "",
  "message_id": "message.pgcrypto-crypt-null",
  "path": "",
  "position": 0,
  "raw": {
    "id": "message.pgcrypto-crypt-null",
    "primary_template": "crypt(3) returned NULL",
    "severity_source": "ERROR",
    "sources": [
      "src.path.0"
    ],
    "sqlstate": "39000"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.0"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "crypt(3) returned NULL",
      "position": 0,
      "role": "",
      "template": "crypt(3) returned NULL"
    }
  ]
}
messages · message.pgcrypto-encrypt
{
  "limits": "px_strerror(err) text is interpolated into the primary message.",
  "message_id": "message.pgcrypto-encrypt",
  "path": "",
  "position": 1,
  "raw": {
    "id": "message.pgcrypto-encrypt",
    "limits": "px_strerror(err) text is interpolated into the primary message.",
    "primary_template": "encrypt error: %s",
    "severity_source": "ERROR",
    "sources": [
      "src.path.0",
      "src.path.1"
    ],
    "sqlstate": "39000"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.0",
    "src.path.1"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "encrypt error:",
      "position": 0,
      "role": "",
      "template": "encrypt error: %s"
    }
  ]
}
messages · message.pgcrypto-decrypt
{
  "limits": "px_strerror(err) text is interpolated into the primary message.",
  "message_id": "message.pgcrypto-decrypt",
  "path": "",
  "position": 2,
  "raw": {
    "id": "message.pgcrypto-decrypt",
    "limits": "px_strerror(err) text is interpolated into the primary message.",
    "primary_template": "decrypt error: %s",
    "severity_source": "ERROR",
    "sources": [
      "src.path.0"
    ],
    "sqlstate": "39000"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.0"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "decrypt error:",
      "position": 0,
      "role": "",
      "template": "decrypt error: %s"
    }
  ]
}
messages · message.pgcrypto-encrypt-iv
{
  "limits": "px_strerror(err) text is interpolated into the primary message.",
  "message_id": "message.pgcrypto-encrypt-iv",
  "path": "",
  "position": 3,
  "raw": {
    "id": "message.pgcrypto-encrypt-iv",
    "limits": "px_strerror(err) text is interpolated into the primary message.",
    "primary_template": "encrypt_iv error: %s",
    "severity_source": "ERROR",
    "sources": [
      "src.path.0"
    ],
    "sqlstate": "39000"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.0"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "encrypt_iv error:",
      "position": 0,
      "role": "",
      "template": "encrypt_iv error: %s"
    }
  ]
}
messages · message.pgcrypto-decrypt-iv
{
  "limits": "px_strerror(err) text is interpolated into the primary message.",
  "message_id": "message.pgcrypto-decrypt-iv",
  "path": "",
  "position": 4,
  "raw": {
    "id": "message.pgcrypto-decrypt-iv",
    "limits": "px_strerror(err) text is interpolated into the primary message.",
    "primary_template": "decrypt_iv error: %s",
    "severity_source": "ERROR",
    "sources": [
      "src.path.0"
    ],
    "sqlstate": "39000"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.0"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "decrypt_iv error:",
      "position": 0,
      "role": "",
      "template": "decrypt_iv error: %s"
    }
  ]
}
messages · message.pgcrypto-length
{
  "limits": "",
  "message_id": "message.pgcrypto-length",
  "path": "",
  "position": 5,
  "raw": {
    "id": "message.pgcrypto-length",
    "primary_template": "Length not in range",
    "severity_source": "ERROR",
    "sources": [
      "src.path.0"
    ],
    "sqlstate": "39000"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.0"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "Length not in range",
      "position": 0,
      "role": "",
      "template": "Length not in range"
    }
  ]
}
messages · message.pgcrypto-library-text
{
  "limits": "The dynamic library text is the primary message, not a separate DETAIL field.",
  "message_id": "message.pgcrypto-library-text",
  "path": "",
  "position": 6,
  "raw": {
    "dynamic_format": "px_strerror(err)",
    "id": "message.pgcrypto-library-text",
    "limits": "The dynamic library text is the primary message, not a separate DETAIL field.",
    "primary_template": "%s",
    "severity_source": "ERROR",
    "sources": [
      "src.path.2"
    ],
    "sqlstate": "39000"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.2"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "",
      "position": 0,
      "role": "",
      "template": "%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#L308"
}
sources · src.path.0
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "contrib/pgcrypto/pgcrypto.c",
  "position": 1,
  "sha256": "126e94f378eea1cbf5480ba54dd3deac8c6dd3fe69c43de23efd2f7697f8a932",
  "source_id": "src.path.0",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/pgcrypto/pgcrypto.c#L234"
}
sources · src.path.1
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "contrib/pgcrypto/pgp-cfb.c",
  "position": 2,
  "sha256": "8484871c594a508f85d3f3de69f759e76eb01b7b08c48e72c379887ecf5bdd6a",
  "source_id": "src.path.1",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/pgcrypto/pgp-cfb.c#L237"
}
sources · src.path.2
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "contrib/pgcrypto/px.c",
  "position": 3,
  "sha256": "0cb9fafb3174e8320f4205d58dea5563a4eb4456e85e8a9f7cf5819b8ea5f23e",
  "source_id": "src.path.2",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/pgcrypto/px.c#L105"
}
sources · src.calls.REL_18_6
{
  "commit": "",
  "docs_url": "",
  "kind": "local_artifact",
  "location": "",
  "path": "raw/calls/REL_18_6.jsonl",
  "position": 4,
  "sha256": "9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf",
  "source_id": "src.calls.REL_18_6",
  "tag": "",
  "url": ""
}

来源引用

完整定义与证据 JSON

定义来源

center · PostgreSQL 18 · english-manuals:c78319705671d97dfeb0898108eff8e8cbff313c9b3ccfdcec3ebb440e0a06c3

正文语言: zh-Hans · english-manuals:c78319705671d97dfeb0898108eff8e8cbff313c9b3ccfdcec3ebb440e0a06c3