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

**Code:** `22P02` · **Category:** PostgreSQL · **Seen on:** PostgreSQL

A string couldn’t be converted to the column’s type (integer, numeric, boolean, date…).

## 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

1. Send NULL instead of ''
2. Validate/parse input before querying
3. Check parameter positions

## Detailed fix by platform

### PostgreSQL

1. `INSERT INTO items (qty) VALUES (NULLIF($1, '')::int);`

## How to diagnose

1. **Value** — Quoted in the message
2. **Column** — Expected type

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/postgresql/invalid-input-syntax-for-type-integer)
