# 22023 — invalid_parameter_value

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

# 22023

## At a glance {#at-a-glance}
A named parameter, option, descriptor, or function argument is outside the domain accepted by its owner. Fixed representatives cover built-in GUC parsing, amcheck descriptors/options, postgres_fdw option validation, and regular-expression option checks; the primary text identifies the owner and value.

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

| Field | Value |
| --- | --- |
| SQLSTATE | `22023` |
| Condition | `invalid_parameter_value` |
| 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_INVALID_PARAMETER_VALUE` |
| Aliases | `—` |

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

The retained PostgreSQL 18.6 and 10.21 observations use the same autocommit case: `SET work_mem = 'not-a-memory-size'` returned SQLSTATE `22023` with `invalid value for parameter "work_mem": "not-a-memory-size"`; `SET work_mem = '1MB'` repaired it and `SHOW work_mem` returned `1MB`. Both backends were `IDLE` after the error and repair. The selected case is the built-in GUC path, not a general result for every 22023 owner; see the [public case JSON](../data/cases/22023.json).

<!-- BEGIN SQLSTATE SNIPPET: invalid_work_mem_parameter -->
```sql
SET work_mem = 'not-a-memory-size';
SET work_mem = '1MB';
SHOW work_mem;
```
<!-- END SQLSTATE SNIPPET -->

## Representative messages {#messages}
These examples share 22023 but belong to separate owners:

| Owner / path | Representative primary text |
| --- | --- |
| Built-in GUC parsing/checks | `parameter "%s" requires a Boolean value`; `invalid value for parameter "%s": "%s"` |
| `verify_heapam` | `relation cannot be null`; `invalid skip option` — HINT: `Valid skip options are "all-visible", "all-frozen", and "none".` |
| `postgres_fdw` | `invalid value for floating point option "%s": %s`; `invalid value for integer option "%s": %s` |
| Regular-expression option parser | `invalid regular expression option: "%.*s"` |

## Meaning {#meaning}
22023 is a shared parameter-validation code whose mechanism belongs to the named owner. Built-in GUC parsing first converts Boolean, integer, real, string, or enum values, checks integer/real ranges and units such as `B`/`MB` or time units, then invokes parameter-specific check hooks; setting context and permissions are separate constraints. `verify_heapam` instead checks required non-NULL descriptors and enumerated skip values, `postgres_fdw` parses numeric/string options and positive bounds, and regexp functions validate option letters or function parameters. These groups share the SQLSTATE but not one universal value domain.

## Diagnosis {#diagnosis}
Start with the command, function, or extension named by the primary message. For a GUC, inspect the parameter’s type, accepted units/range, and whether the current setting context permits the change; for an extension or function, follow its own option list and bounds. The exact `work_mem` case above demonstrates a bad GUC value and a valid unit-bearing repair only. Do not infer the repair for amcheck, postgres_fdw, regexp, or another parameter from that case.

## Response {#response}
Correct the value according to the owning parameter’s documented domain, including its unit and setting context where applicable. In an explicit transaction, a statement-level ERROR requires `ROLLBACK` or `ROLLBACK TO SAVEPOINT` before continuing; an autocommit client can retry the corrected action. In the retained autocommit case the same backend remained IDLE after the error and repair.

## Versions {#versions}
The locked catalogue records this condition from 7.4; fixed source coverage is PostgreSQL 18.6. The retained observation covers the named work_mem case on PostgreSQL 18.6 and 10.21.

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

## Sources {#sources}
Representative built-in GUC conversion/range/check-hook paths are [`src/backend/utils/misc/guc.c#L3129-3320`](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/misc/guc.c#L3129) and [`#L6804-6990`](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/misc/guc.c#L6804), with unit tables at [`#L87-181`](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/misc/guc.c#L87) and setting-context handling at [`#L3342-3430`](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/misc/guc.c#L3342), alongside [`contrib/amcheck/verify_heapam.c#L271-303`](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/amcheck/verify_heapam.c#L271), [`contrib/postgres_fdw/option.c#L149-185`](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/postgres_fdw/option.c#L149), and [`src/backend/utils/adt/regexp.c#L443-446`](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/regexp.c#L443). The structured [evidence record](../data/evidence/22023.json) retains exact messages, runtime digests, and owner-specific limits.
