# 22027 — trim_error

> Source-backed reference for PostgreSQL SQLSTATE 22027.
---

# 22027

## At a glance {#at-a-glance}
The trim operation rejected its argument or trim specification. No fixed PostgreSQL 18.6 emitting path was resolved in the bounded scan.

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

| Field | Value |
| --- | --- |
| SQLSTATE | `22027` |
| Condition | `trim_error` |
| 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_TRIM_ERROR` |
| Aliases | `—` |

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

## Meaning {#meaning}
The locked definition names `trim_error`, but the bounded PostgreSQL 18.6 source review did not resolve a native emitter for 22027. This page therefore records the condition identity and diagnostic boundary without assigning a particular SQL trim function, whitespace rule, or primary message.

## Diagnosis {#diagnosis}
If a deployment reports 22027, preserve the complete primary, DETAIL, and HINT together with the invoking function or extension. The condition name alone cannot tell whether the rejected input is the source string, trim set, direction, or a consumer-specific option; do not substitute a guessed whitespace rule.

## Response {#response}
Use the actual emitter’s diagnostic to correct the trim input or operation. If the source is an extension or a version-specific path, check that implementation’s documented argument rules. If an ERROR occurred in an explicit transaction, roll back or roll back to the existing savepoint before retrying; autocommit can retry the corrected action.

## Versions {#versions}
The locked catalogue records this condition from 7.4. Only the PostgreSQL 18.6 definition row is fixed here; no native emitting path or natural runtime observation is claimed.

## Related {#related}
[`22026`](../22026/), [`22025`](../22025/)

## Sources {#sources}
The fixed definition row is [`src/backend/utils/errcodes.txt#L202`](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt#L202). The bounded source review did not resolve a native 22027 emitter; the structured [evidence record](../data/evidence/22027.json) keeps that unknown scope explicit, and no natural runtime was run.
