SQLSTATE 22010 means a host indicator parameter was given a non-zero, non-null value when Postgres expected 0 or NULL.
PostgreSQL Error 22010 - invalid_indicator_parameter_value - appears when a host indicator parameter sent by a client contains something other than 0 or NULL. Clean the indicator variable or send NULL to resolve the issue.
PostgreSQL Error 22010
The server raises SQLSTATE 22010 when it receives an indicator parameter with an unexpected value. The indicator parameter accompanies a host variable in the extended query protocol and signals NULL status or data length. Allowed values are NULL or 0.
Applications that bind variables through drivers like libpq, JDBC, ODBC, or psycopg may accidentally populate the indicator slot with garbage data.
When Postgres validates the packet it rejects the entire statement and throws Error 22010.
Driver or ORM bugs often write an uninitialized integer to the indicator field. Incorrect hand-rolled binary protocol code also triggers the error. Calling PQexecParams with paramLengths but forgetting to set paramFormat to 1 is another common source.
In wire-level terms, any non-zero byte sequence other than NULL is invalid.
Postgres treats it as protocol violation and aborts the transaction block if one is active.
First, confirm the driver version. Upgrading to the latest stable build fixes many known binding bugs. Next, log statement parameters with log_statement and inspect the bind message in pg_stat_activity or Wireshark.
If you construct messages manually, set the indicator value to -1 for NULL or the exact byte count for non-NULL values and ensure paramFormat matches.
Always initialize arrays before passing them to PQexecParams.
Using outdated psycopg2 versions prior to 2.8.4 with binary COPY often yields Error 22010. Update the package and retest.
JDBC applications that set setNull(index, Types.VARCHAR) on a binary prepared statement need to ensure the connection property binaryTransfer=false or send text format.
Keep database drivers pinned to tested versions. Enable parameter logging in staging to catch malformed binds early.
Validate all indicator buffers are zeroed after allocation in C extensions.
When using Galaxy, the editor’s parameter helper always sets indicator values correctly, preventing malformed packets during ad-hoc testing.
Error 22007 (invalid_datetime_format) occurs when the textual value itself is wrong, unlike 22010 which concerns the indicator field. Error 08P01 (protocol_violation) may appear if the entire bind message is corrupted. Treat both with similar upgrade and validation steps.
.
C or C++ code that allocates an int array for indicators but forgets to zero it leaves random memory values that Postgres rejects.
Legacy versions of psycopg2, pgjdbc, and some ODBC drivers mishandle NULL flags when switching between text and binary formats.
Passing a non-NULL length but still marking the format as text confuses the server and triggers SQLSTATE 22010.
Hand-crafted Bind messages that set the indicator to 1 instead of the byte length violate the spec and fail.
.
No. The server rejects the statement before execution, so no rows are written or changed.
No. The check is part of the PostgreSQL wire protocol and cannot be turned off.
Different driver versions or compiler optimizations between environments can leave indicator variables uninitialized only in one build.
Galaxy’s parameterization engine sets correct indicator values automatically, reducing the risk when testing queries interactively.