40003
Read PG 18 manual ↗statement_completion_unknown
- SQLSTATE
- 40003
- Condition name
- statement_completion_unknown
- Class
- Transaction Rollback
- Source macro
- ERRCODE_T_R_STATEMENT_COMPLETION_UNKNOWN
- Evidence
- Definition only
English SQLSTATE atlas: authored explanations and source/runtime evidence are separate from the manual definitions. View source ↗
At a glance
40003 describes uncertainty about statement completion, generally a reconciliation problem at a connection or protocol boundary. The fixed core scan did not provide a safe SQL-only natural trigger for this batch. A client timeout or a fabricated RAISE is not proof of uncertain server completion: reconcile durable business state before retrying.
Meaning
40003 means statement completion is unknown: after a connection or transport failure, the client cannot tell whether the server completed the statement. It is an outcome-knowledge boundary, not proof that the statement failed and not an instruction to roll back blindly.
Diagnosis
Correlate the request or idempotency key with server logs, backend activity, commit records, and durable business state. A socket exception commonly has no server SQLSTATE, and the fixed scan has no safe core SQL-only 40003 trigger. Treat a client timeout, broken connection, or ROLLBACK on a new session as separate facts rather than evidence that the original statement was undone.
Response
Reconcile before retrying: query authoritative durable state on a new healthy session, use an idempotency key only after matching the original request and business result, and ask the application whether the operation is safe to repeat. Do not claim that a generic retry or rollback resolves an unknown completion, and do not manufacture 40003 with RAISE or a local timeout.
Versions
The locked facts table records catalogue presence across the project snapshot range. The fixed source evidence is limited to the path stated below; no exact behavioral introduction or broader runtime coverage is inferred from the definition alone.
Sources
src.errcodes.18.6(SHA-2566e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba)src.calls.REL_18_6fixed call scan (SHA-2569ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf)
Source evidence
Evidence belongs to the frozen source and runtime versions listed here. It is not a runtime verification of the selected manual version.
40003 is the statement_completion_unknown condition in Class 40.
Method: Read the fixed errcodes.txt row and macro mapping.
Limits: This records the protocol definition and does not imply a natural PostgreSQL throw path.
No distinct safe natural core runtime case for 40003 was selected from the fixed call scan.
Method: Review the fixed call scan for resolved 40003 call groups and reject artificial RAISE or relabeling.
Limits: This is a bounded source/definition result, not proof that every extension or injected fault cannot emit the code.
- src/backend/utils/errcodes.txt · REL_18_6 ·
724edf9bde9d356724ad384a2e196edc3c9f80f7 raw/calls/REL_18_6.jsonl· ·
Message templates
No extracted message template is attached to this condition.
Reproduction & repair cases
statement_completion_boundary · PG 10, 18
Preconditions
- A runner-owned disposable target is provisioned.
Trigger: No connection-loss or uncertain-completion success claim is fabricated.
Expected assertions
Repair: When completion is uncertain, reconcile durable business state before retrying; this page does not claim a SQL-only reproduction.
Cleanup: Drop the case schema with an owner connection.
Recorded runtime evidence
No runtime observation is attached to this entry.
Definition snapshot: english-manuals:b90a15186988610f19ecebac73a… · English manual source