PostgreSQL error: invalid input syntax for type

ERROR:  invalid input syntax for type integer: "abc"

A textual value had to be converted to a typed one — integer, uuid, date, numeric — and could not be parsed. The message quotes the offending value, which usually identifies the source immediately: a header row, an empty string, or data that was never validated.

What this error means

This fires wherever text meets a type: explicit casts ('abc'::int), parameters bound as text, COPY reading a file, or implicit conversions in comparisons. Note what it is not: a NULL problem (NULL casts fine to anything) — it is a value that exists and is malformed for the target type. The empty string is the classic: ''::int fails, because empty is not zero.

Common causes

How to diagnose it

How to fix it