Skip site navigation (1) Skip section navigation (2)

Re: how to handle data containing '\0'

From: Kris Jurka <books(at)ejurka(dot)com>
To: "EBIHARA, Yuichiro" <ebihara(at)iplocks(dot)co(dot)jp>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: how to handle data containing '\0'
Date: 2006-05-22 07:28:52
Message-ID: Pine.BSO.4.63.0605220223540.21575@leary2.csoft.net (view raw or flat)
Thread:
Lists: pgsql-jdbc

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


In response to

Responses

pgsql-jdbc by date

Next:From: Markus SchaberDate: 2006-05-22 07:59:14
Subject: Re: [Pgjdbc-commit] By jurka: Add some more synchronization to the
Previous:From: Kris JurkaDate: 2006-05-22 07:16:36
Subject: Re: Italian translation update and double single quote

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group