pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Csaba Nagy <nagy@ecircle-ag.com>
To: Kris Jurka <books@ejurka.com>
Cc: Postgres JDBC <pgsql-jdbc@postgresql.org>
Subject: Re: Strange error using postgres 8.2 + JDBC 8.2 driver
Date: Wed, 17 Jan 2007 18:24:22 +0100
Message-ID: <1169054662.22307.305.camel@coppola.muc.ecircle.de> (raw)
In-Reply-To: <1169054033.22307.299.camel@coppola.muc.ecircle.de>
References: <1169053117.22307.293.camel@coppola.muc.ecircle.de>
	<Pine.BSO.4.64.0701171202470.29608@leary2.csoft.net>
	<1169054033.22307.299.camel@coppola.muc.ecircle.de>

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.





view thread (5+ messages)

Message-ID: <1169054662.22307.305.camel@coppola.muc.ecircle.de>
Permalink:  ../1169054662.22307.305.camel@coppola.muc.ecircle.de/
Also on:    postgresql.org/message-id/1169054662.22307.305.camel@coppola.muc.ecircle.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: nagy@ecircle-ag.com, books@ejurka.com
  Subject: Re: Strange error using postgres 8.2 + JDBC 8.2 driver
  In-Reply-To: <1169054662.22307.305.camel@coppola.muc.ecircle.de>
  References: <1169053117.22307.293.camel@coppola.muc.ecircle.de> <Pine.BSO.4.64.0701171202470.29608@leary2.csoft.net> <1169054033.22307.299.camel@coppola.muc.ecircle.de> <1169054662.22307.305.camel@coppola.muc.ecircle.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox