42804 PostgreSQL Origin: Data Last updated 14 Oct 2026

ERROR: column "x" is of type integer but expression is of type text — HINT: You will need to rewrite or cast the expression.

An INSERT/UPDATE supplies a value of a different type than the column, and PostgreSQL won’t cast implicitly.

Exact message you may see but expression is of type
Seen on: PostgreSQL

Meaning

Parameters bound as text, jsonb vs json, or enum columns receiving text. Explicit casts fix it.

Common causes

  • Parameters sent as strings
  • Enum column receiving text without cast
  • json vs jsonb mismatch

⚡ Quick fix

  1. Cast: $1::int / $1::my_enum
  2. Fix the driver/ORM type mapping

Detailed fix by platform

PostgreSQL

  1. UPDATE orders SET status = $1::order_status WHERE id = $2;

How to diagnose

  1. Types — Column type vs expression type
  2. Recent change — Did it start after a deploy, upgrade, or configuration change? Compare with the last working version.

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Data. Errors that are often confused with or caused by this one (click to open):

08P01 — ERROR: bind message supplies 2 parameters, but prepared statement requires 1 (PostgreSQL)08P011093 — MySQL ERROR 1093 (HY000): You can't specify target table 'x' for update in FROM clause (MySQL)10931175 — MySQL ERROR 1175 (HY000): You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column (MySQL)11751241 — MySQL ERROR 1241 (21000): Operand should contain 1 column(s) (MySQL)12411690 — MySQL ERROR 1690 (22003): BIGINT UNSIGNED value is out of range (MySQL)169022001 — ERROR: value too long for type character varying(255) (PostgreSQL)2200122003 — ERROR: numeric field overflow — A field with precision 5, scale 2 must round to an absolute value less than 10^3 (PostgreSQL)2200322008 — ERROR: date/time field value out of range: "31/12/2024" — HINT: Perhaps you need a different "datestyle" setting. (PostgreSQL)2200842804

Explore the map of this error Full error map →

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