Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id B9F8C1337B6E for ; Wed, 9 Feb 2011 05:40:18 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 37370-04 for ; Wed, 9 Feb 2011 09:40:11 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from tremor.opencloud.co.nz (tremor.opencloud.co.nz [131.203.101.230]) by mail.postgresql.org (Postfix) with ESMTP id 7A3191337B69 for ; Wed, 9 Feb 2011 05:40:10 -0400 (AST) Received: from 121-98-80-66.bitstream.orcon.net.nz ([121.98.80.66] helo=[192.168.1.2]) by tremor.opencloud.co.nz with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1Pn6Wr-0001ZJ-LL; Wed, 09 Feb 2011 22:40:05 +1300 Message-ID: <4D5260F0.9000908@opencloud.com> Date: Wed, 09 Feb 2011 22:40:00 +1300 From: Oliver Jowett User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) MIME-Version: 1.0 To: Andreas Joseph Krogh CC: pgsql-jdbc@postgresql.org Subject: Re: ResultSet.getClob() causing problems when used with JPA's @Lob References: <201102070001.22259.andreak@officenet.no> <201102070911.20245.rsmogura@softperience.eu> <4D505B02.804@officenet.no> <4D524A75.2090305@officenet.no> In-Reply-To: <4D524A75.2090305@officenet.no> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201102/54 X-Sequence-Number: 21452 Andreas Joseph Krogh wrote: > On 02/09/2011 01:20 AM, Kris Jurka wrote: >> The problem is that we have no idea what someone might want to do with a >> CLOB after they've fetched it. You're coming from the idea that all >> they want to do is read it and copy the data out to a String. From that >> perspective it's not hard to have a Clob wrapper around a String, but >> what happens when they say clob.setString(13, "data")? Are we going to >> try and figure out what row of what table that varchar column is coming >> from and do a partial update on it? > So, I think clob.setString(index, data) should behave just like > StringBuilder.insert(int offset, String str) except overwrite existing > data instead of moving the characters above the position. You really missed Kris' point here - the question is not "how should we modify the data?" but "how do we locate the data to modify in the first place?". Consider: SELECT somedatacolumn FROM sometable WHERE complex condition Now you have a resultset with one column. It's a varchar. The caller calls ResultSet.getClob().setString(). What does the driver do? Synthesize an UPDATE statement? How? With what parameters? Oliver