SQLSTATE 22023 ERROR Class 22: Data Exception

invalid_parameter_value pg_enum OID value not set when in binary upgrade mode — 22023

PostgreSQL error “pg_enum OID value not set when in binary upgrade mode” (SQLSTATE 22023, invalid_parameter_value): what it means, common causes, and how to fix it.

PG 15, 16, 17, 18, 19 Official docs
Last reviewed Jun 2026 Grounded in source
Production impact Medium Competency Transactions & Isolation Career Pass Senior DBA interviews Frequency Occasional

Investigation

Symptoms

A statement failed with SQLSTATE 22023 (invalid_parameter_value), reported at severity ERROR. This is a Data Exception condition: PostgreSQL emits the message pg_enum OID value not set when in binary upgrade mode.

  • The client receives SQLSTATE 22023 (invalid parameter value).
  • The operation is rejected at ERROR level; the statement does not complete.

What the server log shows

ERROR:  pg_enum OID value not set when in binary upgrade mode

Why PostgreSQL raises this

Class 22 (Data Exception) is raised at run time when a value cannot be represented, converted, or processed by the requested type or function — bad input syntax, out-of-range values, or invalid arguments.

As described in PostgreSQL’s Chapter 8 Data Types and Appendix A (PostgreSQL Error Codes), SQLSTATE 22023 carries the condition name invalid_parameter_value in class Data Exception. (Paraphrased — see the linked reference for the exact wording.)

Common causes

  • A literal or parameter does not match the target type’s input format.
  • A value exceeds the range or length the type allows.
  • A function received an argument outside its valid domain.
  • An encoding, cast, or format conversion failed.

How to fix it

  1. Validate and sanitize the input value before sending it.
  2. Cast explicitly to the intended type and confirm the format.
  3. Widen the column/type or clamp the value to the supported range.
  4. Reproduce with the exact literal to see which value is rejected.

Version applicability

This message is present in PostgreSQL 15, 16, 17, 18 and 19.

Related & next steps

Reference: PostgreSQL Chapter 8 Data Types.

Keep going

Related & next steps

Concepts on this page

Was this helpful?