↑↓ select↵ open⌫ change scopeOpen full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Wiki / SQLSTATE

40003 — statement_completion_unknown

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.

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
Transaction Rollback
condition name
statement_completion_unknown
lang
en
sqlstate
40003

Definition PG 18

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.

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 for a server-confirmed retryable outcome; 40003 requires reconciliation because completion is uncertain.

Sources {#sources}

  • src.errcodes.18.6 (SHA-256 6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba)
  • src.calls.REL_18_6 fixed call scan (SHA-256 9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf)

Compare versions

SQLSTATE evidence and recorded runtime versions

cases · statement_completion_boundary
{
  "assertions": [],
  "case_id": "statement_completion_boundary",
  "cleanup": "Drop the case schema with an owner connection.",
  "has_snippet": false,
  "position": 0,
  "preconditions": [
    "A runner-owned disposable target is provisioned."
  ],
  "repair": "When completion is uncertain, reconcile durable business state before retrying; this page does not claim a SQL-only reproduction.",
  "trigger": "No connection-loss or uncertain-completion success claim is fabricated.",
  "versions": [
    "10",
    "18"
  ]
}
claims · identity
{
  "claim_id": "identity",
  "limits": "This records the protocol definition and does not imply a natural PostgreSQL throw path.",
  "method": "Read the fixed errcodes.txt row and macro mapping.",
  "position": 0,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "40003 is the statement_completion_unknown condition in Class 40."
}
claims · no-safe-natural-case
{
  "claim_id": "no-safe-natural-case",
  "limits": "This is a bounded source/definition result, not proof that every extension or injected fault cannot emit the code.",
  "method": "Review the fixed call scan for resolved 40003 call groups and reject artificial RAISE or relabeling.",
  "position": 1,
  "runtime": [],
  "sources": [
    "src.calls.REL_18_6"
  ],
  "statement": "No distinct safe natural core runtime case for 40003 was selected from the fixed call scan."
}
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"
}
sources · src.calls.REL_18_6
{
  "commit": "",
  "docs_url": "",
  "kind": "local_artifact",
  "location": "",
  "path": "raw/calls/REL_18_6.jsonl",
  "position": 1,
  "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:20281c36389be9fa160fe572fa56f0e2f3708279c3f32ce0d33c3c05ce3e34d7

Text language: en · english-manuals:20281c36389be9fa160fe572fa56f0e2f3708279c3f32ce0d33c3c05ce3e34d7