From: Vadim Nasardinov <vadimn@redhat.com>
To: Sebastiaan van Erk <sebster@sebster.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: \0 and IllegalArgumentException
Date: Fri, 29 Oct 2004 10:24:03 -0400
Message-ID: <200410291024.03718@vadim.nasardinov> (raw)
In-Reply-To: <1099043710.595.50.camel@localhost>
References: <1099043710.595.50.camel@localhost>
On Friday 29 October 2004 05:55, Sebastiaan van Erk wrote:
[...]
> however I'm getting:
>
> java.lang.IllegalArgumentException: \0 not allowed
[...]
> 2) I will know where it came from (postgres)...
[...]
> User data CAN in fact contain \0, and the fact that postgres cannot
> handle this is an issue of the backend
Funny you should mention this. Just yesterday a coworker of mine was
bitching about the PostgreSQL JDBC driver's refusal to allow \0 in
strings. As he pointed out, it's not totally clear if the blame rests
entirely with the backend. Consider these examples:
| test=> create table dropme (str varchar(100));
| CREATE TABLE
| test=> insert into dropme values ('Hello' || chr(0) || 'world');
| INSERT 160829 1
| test=> select str, length(str) as length from dropme;
| str | length
| -------+--------
| Hello | 5
| (1 row)
|
| test=> select str, length(str) as length from dropme where str like '%world';
| str | length
| -------+--------
| Hello | 5
| (1 row)
|
| test=> select str, length(str) as length from dropme where str like '%Welt';
| str | length
| -----+--------
| (0 rows)
This is with a fairly old version of PosgreSQL:
| test=> select substring(version(), 1, 20) as version;
| version
| ----------------------
| PostgreSQL 7.3.4-RH
| (1 row)
Not sure how the latest version behaves.
I think you do have a point though when you say that \0 should be
allowed (and handled properly).
Vadim
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: vadimn@redhat.com, sebster@sebster.com
Subject: Re: \0 and IllegalArgumentException
In-Reply-To: <200410291024.03718@vadim.nasardinov>
References: <1099043710.595.50.camel@localhost> <200410291024.03718@vadim.nasardinov>
* 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