39P02
Read PG 18 manual ↗srf_protocol_violated
- SQLSTATE
- 39P02
- Condition name
- srf_protocol_violated
- Class
- External Routine Invocation Exception
- Source macro
- ERRCODE_E_R_I_E_SRF_PROTOCOL_VIOLATED
- Evidence
- Source path confirmed
English SQLSTATE atlas: authored explanations and source/runtime evidence are separate from the manual definitions. View source ↗
At a glance
39P02 is srf_protocol_violated. The fixed executor path checks value-per-call and materialize set-returning-function contracts and reports the exact violated return mode.
Meaning
The executor received a set-returning function state that violated the selected protocol: table-function protocol for value-per-call mode was not followed, table-function protocol for materialize mode was not followed, or unrecognized table-function returnMode: %d.
Diagnosis
Inspect the C or extension function that sets ReturnSetInfo fields, especially returnMode, isDone, and returnSet. This is an SRF protocol issue, not a row-count result.
Response
Repair the SRF value-per-call or materialize implementation and its ReturnSetInfo state; changing LIMIT or transaction policy does not repair the executor contract.
Versions
The locked catalogue records this condition from 7.4 in the listed formal snapshots and 19beta3; fixed source coverage is PostgreSQL 18.6.
Sources
See the fixed execSRF.c and materialize path (lines 665-686) alongside the structured evidence record.
Source evidence
Evidence belongs to the frozen source and runtime versions listed here. It is not a runtime verification of the selected manual version.
The executor reports this code when a set-returning function violates value-per-call or materialize mode, or supplies an unrecognized returnMode.
Method: Read the rsinfo.returnMode, isDone, and returnsSet checks.
The fixed path is an executor-to-set-returning-function contract, not an ordinary query row-count condition.
Method: Interpret the source checks in their executor context.
- src/backend/utils/errcodes.txt · REL_18_6 ·
724edf9bde9d356724ad384a2e196edc3c9f80f7 raw/calls/REL_18_6.jsonl· ·- src/backend/executor/execSRF.c · REL_18_6 ·
724edf9bde9d356724ad384a2e196edc3c9f80f7
Message templates
ERROR · message.srf-value-per-call
Primary
table-function protocol for value-per-call mode was not followed
ERROR · message.srf-materialize
Primary
table-function protocol for materialize mode was not followed
ERROR · message.srf-returnmode
Primary
unrecognized table-function returnMode: %d
Reproduction & repair cases
No reproduction case is attached to this condition.
Recorded runtime evidence
No runtime observation is attached to this entry.
Definition snapshot: english-manuals:b6e1acddab04879fddd4d1af214… · English manual source