22018 — invalid_character_value_for_cast
A character value is rejected by the conversion requested by an operation. The fixed PostgreSQL 18.6 catalogue confirms invalidcharactervalueforcast, but the bounded source scan does not bind this entry to one native emitter or message template.
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
- Data Exception
- condition name
- invalid_character_value_for_cast
- lang
- en
- sqlstate
- 22018
Definition PG 18
At a glance {#at-a-glance}
A character value is rejected by the conversion requested by an operation. The fixed PostgreSQL 18.6 catalogue confirms invalid_character_value_for_cast, but the bounded source scan does not bind this entry to one native emitter or message template.
Meaning {#meaning}
22018 identifies a character representation that the requested conversion cannot accept. The condition name does not select a target type, parser, locale rule, or wrapper; those details belong to the operation that reports the code. Do not turn this definition into an assertion about one particular cast implementation.
Diagnosis {#diagnosis}
Read the complete primary, source and target types, input format, and any locale or type-specific setting. Decide whether the input is malformed for the target parser, outside its range, or rejected by type resolution. A date/time syntax diagnostic, a numeric range diagnostic, and a generic operator mismatch can use neighboring codes; the real message and owner decide which repair applies.
Response {#response}
Correct the source representation or explicit conversion according to the actual source type, target type, and format rules. If the diagnostic comes from a wrapper or extension, follow that consumer's documented parser and do not assume the fixed core scan covers it.
Versions {#versions}
The locked catalogue records this condition from 7.4; fixed source coverage is PostgreSQL 18.6. The exact implementation introduction date and a fixed native emitter remain unresolved by this bounded review.
Related {#related}
Sources {#sources}
The fixed definition is confirmed in errcodes.txt. Runtime verification is not_run; the bounded PostgreSQL 18.6 scan does not resolve a single native emitting path, so this page does not assert a primary template, severity, or transaction effect. The structured evidence record retains the definition and scope boundary.
Compare versions
SQLSTATE evidence and recorded runtime versions
claims · identity
{
"claim_id": "identity",
"limits": "",
"method": "Read the fixed errcodes row and macro.",
"position": 0,
"runtime": [],
"sources": [
"src.errcodes.18.6"
],
"statement": "22018 is invalid_character_value_for_cast in SQLSTATE Class 22."
}claims · bounded-source-scope
{
"claim_id": "bounded-source-scope",
"limits": "A particular parser or wrapper must supply the complete diagnostic context.",
"method": "Keep the catalogue definition separate from an unresolved emitter search.",
"position": 1,
"runtime": [],
"sources": [
"src.errcodes.18.6"
],
"statement": "The bounded PostgreSQL 18.6 source review does not bind 22018 to one native emitter, parser, primary template, or severity."
}claims · history
{
"claim_id": "history",
"limits": "",
"method": "Use catalogue presence and history boundaries.",
"position": 2,
"runtime": [],
"sources": [
"src.errcodes.18.6"
],
"statement": "The locked catalogue records 22018 from 7.4 without proving an exact implementation introduction date."
}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#L188"
}Source references
Full definition and evidence JSON
Definition sources
center · PostgreSQL 18 · english-manuals:08bd01c900f6c5d9df5362ec043f96bb09392d99e59823f0ebe2fa42c2499eb8
Text language: en · english-manuals:08bd01c900f6c5d9df5362ec043f96bb09392d99e59823f0ebe2fa42c2499eb8