Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 917479FB22C for ; Wed, 17 Jan 2007 13:24:36 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 61997-01 for ; Wed, 17 Jan 2007 13:24:23 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mail3.ecircle.de (mail3.ecircle.de [195.140.186.206]) by postgresql.org (Postfix) with ESMTP id BB4219FB22A for ; Wed, 17 Jan 2007 13:24:23 -0400 (AST) Received: from einstein.muc.ecircle.de (einstein.muc.ecircle.de [192.168.1.7]) by mail3.ecircle.de (READY) with ESMTP id F135E55F198; Wed, 17 Jan 2007 18:24:22 +0100 (CET) Received: from [192.168.1.91] ([192.168.1.91]) by einstein.muc.ecircle.de with Microsoft SMTPSVC(6.0.3790.1830); Wed, 17 Jan 2007 18:24:22 +0100 Subject: Re: Strange error using postgres 8.2 + JDBC 8.2 driver From: Csaba Nagy To: Kris Jurka Cc: Postgres JDBC In-Reply-To: <1169054033.22307.299.camel@coppola.muc.ecircle.de> References: <1169053117.22307.293.camel@coppola.muc.ecircle.de> <1169054033.22307.299.camel@coppola.muc.ecircle.de> Content-Type: text/plain Message-Id: <1169054662.22307.305.camel@coppola.muc.ecircle.de> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Wed, 17 Jan 2007 18:24:22 +0100 Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 17 Jan 2007 17:24:22.0877 (UTC) FILETIME=[544838D0:01C73A5C] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/109 X-Sequence-Number: 16474 On Wed, 2007-01-17 at 18:13, Csaba Nagy wrote: > > This will actually happen in 8.1 servers if you are running the latest > > releases. Previously, inserting something like "a\0b" would silently > > truncate at the null byte, but now it's an error. So, check your data for > > \0. OK, I was able to reproduce it using: Connection connection = getConnection(); Statement statement = connection.createStatement(); statement.execute("create table test_null_in_string (data text)"); PreparedStatement prepStatement = connection.prepareStatement("insert into test_null_in_string values (?)"); String test = new String(new byte[] {1, 2, 3, 0, 1, 2, 3}, "US-ASCII"); prepStatement.setString(1, test); // will throw exception prepStatement.executeUpdate(); So it is easily possible... now I have to check how it happens in our system, but I'm afraid I won't like the implications :-/ Cheers, Csaba.