X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id A06CD9FA226 for ; Wed, 17 May 2006 11:36:18 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 25284-09 for ; Wed, 17 May 2006 11:36:02 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from iplocks.co.jp (iplocks.co.jp [211.19.47.137]) by postgresql.org (Postfix) with SMTP id 520259F9C18 for ; Wed, 17 May 2006 11:36:02 -0300 (ADT) Received: (qmail 22224 invoked from network); 17 May 2006 23:35:38 +0900 Received: from unknown (HELO ebihara) (216.132.219.66) by iplocks.co.jp with SMTP; 17 May 2006 23:35:38 +0900 From: "EBIHARA, Yuichiro" To: Subject: Re: how to handle data containing '\0' Date: Wed, 17 May 2006 23:36:59 +0900 Message-ID: <002301c679bf$5e73a730$360aa8c0@ipljp.local> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6626 In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 Importance: Normal X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/73 X-Sequence-Number: 15201 Thank you for your quick response. I understand '\0' cannot be stored in VARCHAR/CHAR columns. I just wonder whether JDBC driver should truncate String without notice or not. Throwing exception is understandable but the behavior was changed in 8.1. This may be a compatibility issue. Thanks, ebi > -----Original Message----- > From: pgsql-jdbc-owner@postgresql.org > [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Larry Rosenman > Sent: Wednesday, May 17, 2006 10:48 PM > To: Marc Herbert; pgsql-jdbc@postgresql.org > Subject: Re: [JDBC] how to handle data containing '\0' > > > Marc Herbert wrote: > > "EBIHARA, Yuichiro" writes: > > > >> > >> I need to handle String data containing '\0' in my Java + JDBC > >> program. Such data can happen at other systems and be sent to > >> PostgreSQL. Here is a sample to simulate it in Java code. > > > > As far as I know, it is not possible to store such strings in a > > postgreSQL database (whatever the client interface used). > The reason > > seems to be that postgreSQL is written in C, and most C > functions use > > \0 as a string terminator. > > > the bytea datatype handles such strings. > > LER > > -- > Larry Rosenman > Database Support Engineer > > PERVASIVE SOFTWARE. INC. > 12365B RIATA TRACE PKWY > 3015 > AUSTIN TX 78727-6531 > > Tel: 512.231.6173 > Fax: 512.231.6597 > Email: Larry.Rosenman@pervasive.com > Web: www.pervasive.com > > ---------------------------(end of > broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match > > >