From jurka at pgfoundry.org Thu Feb 4 00:48:47 2010 From: jurka at pgfoundry.org (User Jurka) Date: Thu, 4 Feb 2010 00:48:47 +0000 (UTC) Subject: [Jdbc-commits] pgjdbc: Protocol sync is lost when a batch statement parameter has an Message-ID: <20100204004848.01AD7107171B@pgfoundry.org> Log Message: ----------- Protocol sync is lost when a batch statement parameter has an embedded null byte. When the server responds with an error message, the batch error handler tries to construct the equivalent original query text with the parameters substituted in. This conversion fails on the driver side with an IllegalArgumentException complaining about the null byte. There isn't a catch block in place to handle that exception, so it returns all the way to the user without processing the remainder of the protocol stream. Later queries get confused because they see the leftover messages from the failed batch execution instead of their own results. Avoid throwing the IllegalArgumentException and instead don't bother being strictly accurate with the query text escaping as it's just informational. Modified Files: -------------- pgjdbc/org/postgresql/core/v3: SimpleParameterList.java (r1.17 -> r1.18) (http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/jdbc/pgjdbc/org/postgresql/core/v3/SimpleParameterList.java?r1=1.17&r2=1.18) pgjdbc/org/postgresql/test/jdbc2: BatchExecuteTest.java (r1.16 -> r1.17) (http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/jdbc/pgjdbc/org/postgresql/test/jdbc2/BatchExecuteTest.java?r1=1.16&r2=1.17) From jurka at pgfoundry.org Thu Feb 4 00:48:54 2010 From: jurka at pgfoundry.org (User Jurka) Date: Thu, 4 Feb 2010 00:48:54 +0000 (UTC) Subject: [Jdbc-commits] pgjdbc: Protocol sync is lost when a batch statement parameter has an Message-ID: <20100204004854.9C123107171E@pgfoundry.org> Log Message: ----------- Protocol sync is lost when a batch statement parameter has an embedded null byte. When the server responds with an error message, the batch error handler tries to construct the equivalent original query text with the parameters substituted in. This conversion fails on the driver side with an IllegalArgumentException complaining about the null byte. There isn't a catch block in place to handle that exception, so it returns all the way to the user without processing the remainder of the protocol stream. Later queries get confused because they see the leftover messages from the failed batch execution instead of their own results. Avoid throwing the IllegalArgumentException and instead don't bother being strictly accurate with the query text escaping as it's just informational. Tags: ---- REL8_4_STABLE Modified Files: -------------- pgjdbc/org/postgresql/core/v3: SimpleParameterList.java (r1.17 -> r1.17.2.1) (http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/jdbc/pgjdbc/org/postgresql/core/v3/SimpleParameterList.java?r1=1.17&r2=1.17.2.1) pgjdbc/org/postgresql/test/jdbc2: BatchExecuteTest.java (r1.16 -> r1.16.4.1) (http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/jdbc/pgjdbc/org/postgresql/test/jdbc2/BatchExecuteTest.java?r1=1.16&r2=1.16.4.1)