ERROR: invalid input syntax for type integer: "abc"
A string couldn’t be converted to the column’s type (integer, numeric, boolean, date…).
invalid input syntax for type integerinvalid input syntax for type Meaning
Empty strings, "undefined"/"null" strings from JavaScript, or text in numeric columns. PostgreSQL never treats '' as NULL.
Common causes
- Empty string '' for numeric columns
- "undefined" from a frontend
- Wrong parameter order in queries
⚡ Quick fix
- Send NULL instead of ''
- Validate/parse input before querying
- Check parameter positions
Detailed fix by platform
PostgreSQL
INSERT INTO items (qty) VALUES (NULLIF($1, '')::int);
How to diagnose
- Value — Quoted in the message
- Column — Expected type
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in PostgreSQL
- could not connect PostgreSQL: could not connect to server / connection refused — Is the server running on host and accepting TCP/IP connections?
- 25P02 ERROR: current transaction is aborted, commands ignored until end of transaction block
- pg_restore text dump pg_restore: error: input file appears to be a text format dump. Please use psql.
Other ways to find it
Where this error sits
Origin: Data. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 13 Oct 2026