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_parameter_value

SQLSTATE
22023
Condition name
invalid_parameter_value
Class
Data Exception
Source macro
ERRCODE_INVALID_PARAMETER_VALUE
Evidence
Observed at runtime in the source evidence
Analysis & operational context

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

<h1>22023</h1>

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.

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.

SET work_mem = 'not-a-memory-size';
SET work_mem = '1MB';
SHOW work_mem;

Representative 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

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

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

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

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.

Sources

Representative built-in GUC conversion/range/check-hook paths are src/backend/utils/misc/guc.c#L3129-3320 and #L6804-6990, with unit tables at #L87-181 and setting-context handling at #L3342-3430, alongside contrib/amcheck/verify_heapam.c#L271-303, contrib/postgres_fdw/option.c#L149-185, and src/backend/utils/adt/regexp.c#L443-446. The structured evidence record retains exact messages, runtime digests, and owner-specific limits.

Source evidence

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

22023 is invalid_parameter_value in SQLSTATE Class 22

Method: Read the fixed errcodes row and macro.

src.errcodes.18.6

Fixed PostgreSQL 18.6 representatives bind owner-specific NULL/option/range checks and built-in GUC parse/range/unit/context/check-hook paths.

Method: Read complete source contexts for the representative guards.

Limits: Source confirmation is not a natural runtime observation.

src.amcheck src.postgres_fdw src.regexp.options src.guc.parse src.guc.hooks src.guc.units src.guc.context

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

Method: Use catalogue presence and history boundaries.

src.errcodes.18.6

The retained invalid_work_mem_parameter case passed on PostgreSQL 18.6 and 10.21 with the observed message and repair described on the page.

Method: Read both retained summaries, raw digests, and the fixed snippet registry.

Limits: The observation covers the named GUC case and does not generalize to every 22023 owner.

runtime.22023-work-mem-latest.latest runtime.22023-work-mem-pg10.pg10 snippet-registry.22023

Message templates

ERROR · message.0

Primary

relation cannot be null
ERROR · message.1

Primary

on_error_stop cannot be null
ERROR · message.2

Primary

check_toast cannot be null
ERROR · message.3

Primary

skip cannot be null
ERROR · message.4

Primary

invalid skip option

Hint

Valid skip options are "all-visible", "all-frozen", and "none".
ERROR · message.5

Primary

invalid value for floating point option "%s": %s
ERROR · message.6

Primary

"%s" must be a floating point value greater than or equal to zero
ERROR · message.7

Primary

invalid value for integer option "%s": %s
ERROR · message.8

Primary

"%s" must be an integer value greater than zero
ERROR · message.9

Primary

invalid regular expression option: "%.*s"
ERROR · message.guc-bool

Primary

parameter "%s" requires a Boolean value
ERROR · message.guc-invalid

Primary

invalid value for parameter "%s": "%s"
ERROR · message.guc-range-int

Primary

%d%s%s is outside the valid range for parameter "%s" (%d%s%s .. %d%s%s)
ERROR · message.guc-range-real

Primary

%g%s%s is outside the valid range for parameter "%s" (%g%s%s .. %g%s%s)

Reproduction & repair cases

invalid_work_mem_parameter · PG 10, 18

Preconditions

  • A runner-owned disposable target is provisioned.

Trigger: Set the built-in work_mem parameter to the invalid memory-size text not-a-memory-size.

Expected assertions

  • SQLSTATE is 22023 with the invalid work_mem value diagnostic
  • The failed autocommit session remains IDLE
  • A valid work_mem value is accepted in the same session and SHOW reports 1MB

Repair: Set work_mem to a valid memory value in the same session; do not interpret a parameter-value error as a connection failure.

Cleanup: Close the runner connection and drop the case schema with an owner connection.

Recorded runtime evidence

18.6 (Homebrew) · passed

Run: 22023-work-mem-latest

{
  "sqlstate": "22023",
  "status_after_repair": "IDLE"
}
10.21 (Debian 10.21-1.pgdg90+1) · passed

Run: 22023-work-mem-pg10

{
  "sqlstate": "22023",
  "status_after_repair": "IDLE"
}

Definition snapshot: english-manuals:0bce111663bca13943473f10150… · English manual source