invalid input syntax for type double precision: “…”

SQLSTATE 22P02 condition invalid_text_representation class 22 — Data Exception severity ERROR
Reproduced & verified on PostgreSQL 14.23, 15.18, 16.14, 17.10 and 18.4 — identical message on every version.
Last reviewed 30 May 2025 · Reproduced live with the SQL on this page.

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).

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

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”.