百科 / 错误代码 / Class 39 外部例程调用异常
39P02 srf_protocol_violated
ERROR 源码确认 参考 未实测
- 条件名
srf_protocol_violated- 宏名称
ERRCODE_E_R_I_E_SRF_PROTOCOL_VIOLATED- 启用版本
- 7.4
- 状态
- 活跃
版本覆盖
速览
39P02 是 srf_protocol_violated。固定 executor 源码确认它检查 set-returning function 的 value-per-call、materialize 以及 returnMode 契约。
含义
SQL 执行器收到的 ReturnSetInfo 状态与函数声明/实现不一致时,会报告此条件:报文可能是 table-function protocol for value-per-call mode was not followed、table-function protocol for materialize mode was not followed 或 unrecognized table-function returnMode: %d。它描述 SRF 协议,不是普通 SELECT 的行数结果。
报文模板
源码里的格式串,不是某一次运行的输出。%s 之类是占位符,实际报文会填入对象名与取值。适用范围一栏是核验时留下的原始英文记录,未经翻译。
table-function protocol for value-per-call mode was not followed
table-function protocol for materialize mode was not followed
unrecognized table-function returnMode: %d
诊断
从完整消息判断是哪一类模式,再检查扩展或 C 函数如何设置 rsinfo.returnMode、isDone、returnSet 以及结果存储。优先定位提供该 set-returning function 的函数体和部署版本;不要把客户端收到的空结果误判成 39P02。
处置
修正 SRF 实现以遵守所选 value-per-call 或 materialize 协议,并重新验证其 ReturnSetInfo 字段与返回声明。修复函数契约后再重试调用;仅改变 SQL 的 LIMIT、事务或客户端重试策略不能修复该 executor 协议错误。
版本
锁定目录从 7.4 记录该条件,并在正式快照及 19beta3 中出现;固定报告该码的路径 为 PostgreSQL 18.6 execSRF.c。
来源
- 上游源码 src/backend/utils/errcodes.txt 第 312 行
- 上游源码 src/backend/executor/execSRF.c 第 363–365 行
- 核验材料 raw/calls/REL_18_6.jsonl
证据
断言
每条断言都写明了是怎么核实的,以及它不覆盖什么。这一层是核验时留下的原始英文记录,照原样呈现,未经翻译。
-
39P02 is srf_protocol_violated in Class 39.
-
The executor reports this code when a set-returning function violates value-per-call or materialize mode, or supplies an unrecognized returnMode.
-
The fixed path is an executor-to-set-returning-function contract, not an ordinary query row-count condition.
同类错误代码
Class 39 外部例程调用异常 下的其他成员。