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

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

文档 / SQL 状态码 / Class 39 外部例程调用异常

39000 external_routine_invocation_exception

ERROR 源码确认 参考 未实测

类别
Class 39 外部例程调用异常
严重等级
ERROR
条件名
external_routine_invocation_exception
宏名称
ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION
启用版本
7.4
状态
活跃

版本覆盖

速览

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

含义

代表性消息包括 crypt(3) returned NULLencrypt error: %sdecrypt error: %sencrypt_iv error: %sdecrypt_iv error: %sLength not in range。多个主消息会直接插入 px_strerror(err) 返回的动态库文本;这里的动态内容属于主消息,不是独立的 DETAIL 字段。

消息

代表性消息包括 crypt(3) returned NULLencrypt error: %sdecrypt error: %sencrypt_iv error: %sdecrypt_iv error: %sLength not in range。多个变体把 px_strerror(err) 返回的动态库文本直接放入主消息;它不是独立的 DETAIL 字段。

报文模板

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

主消息 crypt(3) returned NULL

来源:contrib/pgcrypto/pgcrypto.c @ REL_18_6

主消息 encrypt error: %s

来源:contrib/pgcrypto/pgcrypto.c @ REL_18_6 · contrib/pgcrypto/pgp-cfb.c @ REL_18_6

适用范围:px_strerror(err) text is interpolated into the primary message.

主消息 decrypt error: %s

来源:contrib/pgcrypto/pgcrypto.c @ REL_18_6

适用范围:px_strerror(err) text is interpolated into the primary message.

主消息 encrypt_iv error: %s

来源:contrib/pgcrypto/pgcrypto.c @ REL_18_6

适用范围:px_strerror(err) text is interpolated into the primary message.

主消息 decrypt_iv error: %s

来源:contrib/pgcrypto/pgcrypto.c @ REL_18_6

适用范围:px_strerror(err) text is interpolated into the primary message.

主消息 Length not in range

来源:contrib/pgcrypto/pgcrypto.c @ REL_18_6

主消息 %s

来源:contrib/pgcrypto/px.c @ REL_18_6

适用范围:The dynamic library text is the primary message, not a separate DETAIL field.

诊断

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

处理

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

版本

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

来源

证据

断言

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

  • 39000 is external_routine_invocation_exception in SQLSTATE Class 39.

    核实方式Read the fixed errcodes definition row, severity, and macro.

    来源src/backend/utils/errcodes.txt

  • The fixed PostgreSQL 18.6 source contains the report contexts and message variants described on the page.

    核实方式Read the complete source context around the resolved report groups.

    不覆盖Source confirmation is not a runtime observation in this batch.

    来源contrib/pgcrypto/pgcrypto.c · contrib/pgcrypto/pgp-cfb.c · contrib/pgcrypto/px.c

  • Locked release definitions establish catalogue presence from 7.4; they do not establish a precise introducing release or runtime use.

    核实方式Compare canonical release facts with the available history boundary.

    不覆盖Definition presence is not an emitting-path observation.

    来源src/backend/utils/errcodes.txt

同类 SQL 状态码

状态码 条件名 宏名称 严重等级 版本
Class 39 外部例程调用异常 External Routine Invocation Exception 6 个
39000 external_routine_invocation_exception ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION ERROR 7.4
外部例程调用异常,如 pgcrypto 的库失败。 活跃
39001 invalid_sqlstate_returned ERRCODE_E_R_I_E_INVALID_SQLSTATE_RETURNED ERROR 7.4
外部例程返回了无效的 SQLSTATE。 活跃
39004 null_value_not_allowed ERRCODE_E_R_I_E_NULL_VALUE_NOT_ALLOWED ERROR 7.4
外部例程调用中不允许出现 NULL 值。 活跃
39P01 trigger_protocol_violated ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED ERROR 7.4
触发器违反了返回值或调用协议。 活跃
39P02 srf_protocol_violated ERRCODE_E_R_I_E_SRF_PROTOCOL_VIOLATED ERROR 7.4
集合返回函数违反了 SRF 调用协议。 活跃
39P03 event_trigger_protocol_violated ERRCODE_E_R_I_E_EVENT_TRIGGER_PROTOCOL_VIOLATED ERROR 9.5
事件触发器辅助函数在错误的事件上下文调用。 活跃