SQLSTATE 22P02 ERROR Class 22: Data Exception

invalid_text_representation invalid input syntax for type double precision: “…” — 22P02

PostgreSQL error "invalid input syntax for type double precision: "…"" (SQLSTATE 22P02): what it means, common causes, and how to fix it.

PG 12, 13, 14, 15, 16, 17, 18 Official docs
Last reviewed May 2025 Grounded in source

Diagnostic Queries

Symptoms

A string given where a double precision (float8) was expected is not a valid floating-point number. PostgreSQL raises SQLSTATE 22P02 (invalid_text_representation).

  • Non-numeric text or malformed float in a numeric field.
  • Common with empty strings or locale decimal commas.
  • The message echoes the offending value.

What the server log shows

ERROR:  invalid input syntax for type double precision: "1.0.0"

Why PostgreSQL raises this — what the manual says

Section 8.1.3 Floating-Point Types:

“The data types real and double precision are inexact, variable-precision numeric types.”

The float8 input function parses the text as a floating-point literal (optionally NaN/Infinity). Malformed input cannot be parsed and is rejected with 22P02.

Common causes

  • Multiple decimal points or stray characters.
  • A locale decimal comma (1,5) instead of a point.
  • An empty string passed instead of NULL.

How to fix it

  1. Normalize numeric text (single decimal point, no separators).
  2. Convert locale decimals to a point before insert.
  3. Use NULL for missing values.

Related & next steps

Reference: PostgreSQL 18 Section 8.1 “Numeric Types”.

Was this helpful?