# 40003 — statement_completion_unknown

> Source-backed reference for PostgreSQL SQLSTATE 40003, with explicit mechanism boundaries.
---

# 40003 — statement_completion_unknown

## At a glance {#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.

<!-- BEGIN SQLSTATE FACTS: generated by scripts/generate.py; do not edit -->

| Field | Value |
| --- | --- |
| SQLSTATE | `40003` |
| Condition | `statement_completion_unknown` |
| Status | `active` |
| Known present by | `7.4` |
| Locked snapshots | `9.0.23, 9.1.24, 9.2.24, 9.3.25, 9.4.26, 9.5.25, 9.6.24, 10.23, 11.22, 12.22, 13.23, 14.24, 15.19, 16.15, 17.11, 18.6, 19beta3` |
| Macros | `ERRCODE_T_R_STATEMENT_COMPLETION_UNKNOWN` |
| Aliases | `—` |

<!-- source facts: data/errcodes/40003.json -->
<!-- END SQLSTATE FACTS -->

## Meaning {#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 {#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 {#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 {#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.

## Related {#related}

Compare [40001 serialization failure](../40001/) for a server-confirmed retryable outcome; 40003 requires reconciliation because completion is uncertain.

## Sources {#sources}

- [`src.errcodes.18.6`](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt) (SHA-256 `6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba`)
- `src.calls.REL_18_6` fixed call scan (SHA-256 `9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf`)
