On Teiid 11.0 (and probably later versions, as well) running in a WildFly there is a problem when binding to a NULLABLE parameter in a prepared statement with NULL value when running against a PostgreSQL source from a PDO (PHP) ODBC client.
PDO calls causing the error are related to PDOStatement::bindValue
and PDOStatement::bindParam.
It occurs exclusively when the client is trying to bind a NULL value (corresponding to a NULLABLE column in a table) to the prepared statement using PDO::PARAM_NULL type.
Example PHP code
$dbh = new PDO('pgsql:host=<teiid_host>;port=35432;dbname=<vdb_name>;user=<teiid_user>;password=<teiid_password>'); $stmt = $dbh->prepare("INSERT INTO foobar (id, optional) VALUES(?, ?)"); $stmt->bindValue(1, 1); $stmt->bindValue(2, null, PDO::PARAM_NULL); $stmt->execute();
Exception thrown is
Caused by: java.lang.NegativeArraySizeException
at org.teiid.transport.PgFrontendProtocol.createByteArray(PgFrontendProtocol.java:328)
at org.teiid.transport.PgFrontendProtocol.buildBind(PgFrontendProtocol.java:266)
at org.teiid.transport.PgFrontendProtocol.createRequestMessage(PgFrontendProtocol.java:153)
at org.teiid.transport.PgFrontendProtocol.decode(PgFrontendProtocol.java:133)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:411)
... 15 more
- is related to
-
TEIID-5617 Insert command complete for pg/odbc is incorrect
- Resolved