X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C1B783A4BD5 for ; Fri, 29 Oct 2004 15:18:14 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 43267-07 for ; Fri, 29 Oct 2004 14:18:07 +0000 (GMT) Received: from mx1.redhat.com (mx1.redhat.com [66.187.233.31]) by svr1.postgresql.org (Postfix) with ESMTP id E20AA3A4BC4 for ; Fri, 29 Oct 2004 15:18:09 +0100 (BST) Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id i9TEI9oa030383; Fri, 29 Oct 2004 10:18:09 -0400 Received: from mail.boston.redhat.com (mail.boston.redhat.com [172.16.76.12]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i9TEI9r21307; Fri, 29 Oct 2004 10:18:09 -0400 Received: from 192.168.1.2 (vpn83-134.boston.redhat.com [172.16.83.134]) by mail.boston.redhat.com (8.12.8/8.12.8) with ESMTP id i9TEI7FE025986; Fri, 29 Oct 2004 10:18:07 -0400 From: Vadim Nasardinov Organization: Red Hat / Westford To: Sebastiaan van Erk , pgsql-jdbc@postgresql.org Subject: Re: \0 and IllegalArgumentException Date: Fri, 29 Oct 2004 10:24:03 -0400 User-Agent: KMail/1.5.4 References: <1099043710.595.50.camel@localhost> In-Reply-To: <1099043710.595.50.camel@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200410291024.03718@vadim.nasardinov> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/303 X-Sequence-Number: 11408 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