select open change scope Open full search

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

SQLSTATE / CLASS 22 · DATA EXCEPTION

invalid_character_value_for_cast

SQLSTATE
22018
Condition name
invalid_character_value_for_cast
Class
Data Exception
Source macro
ERRCODE_INVALID_CHARACTER_VALUE_FOR_CAST
Evidence
Definition only
Analysis & operational context

English SQLSTATE atlas: authored explanations and source/runtime evidence are separate from the manual definitions. View source ↗

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

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

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

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

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.

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.

Source evidence

Evidence belongs to the frozen source and runtime versions listed here. It is not a runtime verification of the selected manual version.

22018 is invalid_character_value_for_cast in SQLSTATE Class 22.

Method: Read the fixed errcodes row and macro.

src.errcodes.18.6

The bounded PostgreSQL 18.6 source review does not bind 22018 to one native emitter, parser, primary template, or severity.

Method: Keep the catalogue definition separate from an unresolved emitter search.

Limits: A particular parser or wrapper must supply the complete diagnostic context.

src.errcodes.18.6

The locked catalogue records 22018 from 7.4 without proving an exact implementation introduction date.

Method: Use catalogue presence and history boundaries.

src.errcodes.18.6

Message templates

No extracted message template is attached to this condition.

Reproduction & repair cases

No reproduction case is attached to this condition.

Recorded runtime evidence

No runtime observation is attached to this entry.

Definition snapshot: english-manuals:36f03ca7a21ccee9ef9b330e441… · English manual source