[teiid-issues] [JBoss JIRA] (TEIID-5615) Error when binding NULL to nullable parameter in a prepared statement with PDO PostgreSQL ODBC client

Steven Hawkins (Jira) issues at jboss.org
Wed Jan 23 09:59:00 EST 2019


     [ https://issues.jboss.org/browse/TEIID-5615?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steven Hawkins resolved TEIID-5615.
-----------------------------------
    Fix Version/s: 12.1
                   11.2.2
                   12.0.1
       Resolution: Done


Your temporary fix is the correct one.  Null bindings are specified with a length of -1.

> Error when binding NULL to nullable parameter in a prepared statement with PDO PostgreSQL ODBC client
> -----------------------------------------------------------------------------------------------------
>
>                 Key: TEIID-5615
>                 URL: https://issues.jboss.org/browse/TEIID-5615
>             Project: Teiid
>          Issue Type: Bug
>          Components: ODBC
>    Affects Versions: 11.0, 11.2
>         Environment: All infrastructure is Dockerized on Windows 64bit (see below)
> WildFly Full 11.0.0.Final (WildFly Core 3.0.8.Final)
> Teiid Engine 11.2.0
> DatabaseProductVersion=11.1 (Debian 11.1-1.pgdg90+1)
> PostgreSQL JDBC Driver=42.2.5
> PDO Driver for PostgreSQL (from phpinfo())
> PostgreSQL(libpq) Version: 9.6.10
> Module version: 7.1.26
>            Reporter: George Ushakov
>            Assignee: Steven Hawkins
>            Priority: Major
>             Fix For: 12.1, 11.2.2, 12.0.1
>
>
> 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|https://secure.php.net/manual/en/pdostatement.bindvalue.php]
> and [PDOStatement::bindParam|https://secure.php.net/manual/en/pdostatement.bindparam.php].
> 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
> {code:php}
> $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();
> {code}
> 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



--
This message was sent by Atlassian Jira
(v7.12.1#712002)


More information about the teiid-issues mailing list