2F005 — function_executed_no_return_statement
PL/pgSQL reports 2F005 at ERROR level when a function or trigger procedure reaches the end without the required RETURN. The fixed 18.6 paths distinguish an ordinary function from a trigger procedure in their messages.
English manual coverage begins with PostgreSQL 8.1. Source history and runtime observations have their own recorded version boundaries.
Reading PG 18·Select a recorded version
- aliases
- Unknown
- class name
- SQL Routine Exception
- condition name
- function_executed_no_return_statement
- lang
- en
- sqlstate
- 2F005
Definition PG 18
2F005
At a glance {#at-a-glance}
PL/pgSQL reports 2F005 at ERROR level when a function or trigger procedure reaches the end without the required RETURN. The fixed 18.6 paths distinguish an ordinary function from a trigger procedure in their messages.
Meaning {#meaning}
The confirmed messages are control reached end of function without RETURN and control reached end of trigger procedure without RETURN. The return requirement depends on the routine kind and declared return behavior; it is not a generic “function returned NULL” message.
Messages {#messages}
The confirmed messages are control reached end of function without RETURN and control reached end of trigger procedure without RETURN. The return requirement depends on the routine kind and declared return behavior; this is not a generic “function returned NULL” message.
Diagnosis {#diagnosis}
Read the routine signature and the control-flow paths that can reach the end. For a trigger procedure, inspect each branch that should return the trigger row or NULL according to the trigger contract; for a value-returning function, inspect every branch for a compatible RETURN.
Response {#response}
Add the required return path and validate the routine definition before rerunning the operation. This is a routine control-flow repair; retry only after considering whether the enclosing operation performed any visible work.
Versions {#versions}
The locked catalogue places this condition at least by PostgreSQL 7.4. The facts block lists the published snapshots; source-path status is limited to the fixed PostgreSQL 18.6 evidence below.
Related {#related}
Sources {#sources}
See the fixed source links and message limits in the structured evidence record.
Compare versions
SQLSTATE evidence and recorded runtime versions
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": "2F005 is function_executed_no_return_statement in SQLSTATE Class 2F."
}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"
],
"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.plpgsql-function-no-return
{
"limits": "",
"message_id": "message.plpgsql-function-no-return",
"path": "",
"position": 0,
"raw": {
"id": "message.plpgsql-function-no-return",
"primary_template": "control reached end of function without RETURN",
"severity_source": "ERROR",
"sources": [
"src.path.0"
],
"sqlstate": "2F005"
},
"severity": "ERROR",
"sources": [
"src.path.0"
],
"templates": [
{
"kind": "primary",
"literal": "control reached end of function without RETURN",
"position": 0,
"role": "",
"template": "control reached end of function without RETURN"
}
]
}messages · message.plpgsql-trigger-no-return
{
"limits": "The same trigger template appears at more than one fixed control-flow path.",
"message_id": "message.plpgsql-trigger-no-return",
"path": "",
"position": 1,
"raw": {
"id": "message.plpgsql-trigger-no-return",
"limits": "The same trigger template appears at more than one fixed control-flow path.",
"primary_template": "control reached end of trigger procedure without RETURN",
"severity_source": "ERROR",
"sources": [
"src.path.0"
],
"sqlstate": "2F005"
},
"severity": "ERROR",
"sources": [
"src.path.0"
],
"templates": [
{
"kind": "primary",
"literal": "control reached end of trigger procedure without RETURN",
"position": 0,
"role": "",
"template": "control reached end of trigger procedure without RETURN"
}
]
}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#L289"
}sources · src.path.0
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/pl/plpgsql/src/pl_exec.c",
"position": 1,
"sha256": "0df3c70a6bccf6dddf443fb99e152a16a67009827c44a820597e98e585cb8b20",
"source_id": "src.path.0",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/pl/plpgsql/src/pl_exec.c#L639"
}sources · src.calls.REL_18_6
{
"commit": "",
"docs_url": "",
"kind": "local_artifact",
"location": "",
"path": "raw/calls/REL_18_6.jsonl",
"position": 2,
"sha256": "9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf",
"source_id": "src.calls.REL_18_6",
"tag": "",
"url": ""
}Source references
Full definition and evidence JSON
Definition sources
center · PostgreSQL 18 · english-manuals:0e435c33180d445d75a9f20aa7effdb7cdf52ea4ef7a069fe269a95a63e7b08f
Text language: en · english-manuals:0e435c33180d445d75a9f20aa7effdb7cdf52ea4ef7a069fe269a95a63e7b08f