DBAtlas · Database operations atlas

42P18: indeterminate_datatype

PostgreSQL

What does it mean?

PostgreSQL could not infer the data type of an expression or parameter from context. Most often seen when an untyped placeholder (such as $1) or a bare NULL is used with no type hint around it.

Why does it happen?

Untyped parameters in prepared statements; comparisons where both sides are indeterminate, such as "WHERE $1 = $2"; or context-free use of NULL/array literals. The planner cannot decide which type to use.

How to fix it

Add an explicit cast to the indeterminate expression: $1::text, $1::integer, NULL::date, etc. For example: SELECT $1::int + 1; Specify types for driver/ORM parameters. In column comparisons, make sure at least one side has a known type.

Open in DBAtlas →

More from this engine