// PostgreSQL error reference

PostgreSQL 22023: invalid parameter value

A setting or function argument has a value outside what it accepts: an unknown time zone, a bad unit in a memory setting, a zero step in generate_series.

SQLSTATE
22023
Name
invalid_parameter_value
Category
Data Exception
Error message
invalid value for parameter "TimeZone": "Mars/Olympus"

What it means

22023 (invalid_parameter_value) means the value is the right type but not an allowed value. For configuration parameters the message is invalid value for parameter "name": "value", often with a hint listing the valid units or values. Many built-in functions use the same code for bad arguments, such as step size cannot equal zero from generate_series.

Read the message and hint closely: they name the parameter and, usually, what is allowed.

Common causes

  • A time zone name PostgreSQL doesn't know (the valid names are in pg_timezone_names).
  • A memory or time setting with a wrong unit, such as work_mem = '64mb' instead of '64MB' (units are case-sensitive).
  • A function argument out of its allowed range or set, such as a zero step or an unknown option keyword.

How to fix it

  1. Check the valid values for a setting.

    SELECT name, unit, vartype, min_val, max_val, enumvals
    FROM pg_settings WHERE name = 'work_mem';
  2. Pick a time zone from the list PostgreSQL knows.

    SELECT name FROM pg_timezone_names WHERE name ILIKE '%new_york%';
    SET TimeZone = 'America/New_York';
  3. Use units as PostgreSQL spells them: kB, MB, GB, TB for memory and us, ms, s, min, h, d for time.

    SET work_mem = '64MB';
    SET statement_timeout = '30s';

Reproduce it safely

SET TimeZone = 'Mars/Olympus';  -- ERROR: invalid value for parameter "TimeZone": "Mars/Olympus"

Related errors

More data exception errors

The code and message text are from the PostgreSQL documentation, Appendix A: PostgreSQL Error Codes. Browse the full PostgreSQL error list or search every database error.

// fewer errors, faster fixes

Work on PostgreSQL in SQLly

A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for PostgreSQL and the other databases you use.