X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 21B159F94EA for ; Mon, 22 May 2006 04:29:02 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 19827-07 for ; Mon, 22 May 2006 04:28:53 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail63.csoft.net (mail63.csoft.net [205.205.214.4]) by postgresql.org (Postfix) with SMTP id ED29B9F946B for ; Mon, 22 May 2006 04:28:52 -0300 (ADT) Received: (qmail 24295 invoked by uid 1112); 22 May 2006 07:28:52 -0000 Date: Mon, 22 May 2006 02:28:52 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary2.csoft.net To: "EBIHARA, Yuichiro" cc: pgsql-jdbc@postgresql.org Subject: Re: how to handle data containing '\0' In-Reply-To: <001f01c679a9$a3627350$360aa8c0@ipljp.local> Message-ID: References: <001f01c679a9$a3627350$360aa8c0@ipljp.local> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/90 X-Sequence-Number: 15218 On Wed, 17 May 2006, EBIHARA, Yuichiro wrote: > I need to handle String data containing '\0' in my Java + JDBC program. > > Now I have to support two versions of drivers, 7.4 and 8.1, but the > behavior of driver depends on versions when I insert this String value. > This was changed between 7.4 and 8.0 when prepared statements changed from dynamically creating a sql string from the parameters to passing the parameters separately. When creating a sql string the parameters had to be carefully checked for ' and \ so checking for \0 was also done. When passing the parameters separately there is no need for the ' and \ checks so the \0 check was removed as well either unintentionally or for perfomance reasons. New server releases for all versions will be out this week that fix the problem on the server side by explicitly rejecting \0 rather than truncating. Kris Jurka