Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bPsv3-0006F7-Fv for pgsql-jdbc@arkaria.postgresql.org; Wed, 20 Jul 2016 14:56:17 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bPsv2-0000Nx-86 for pgsql-jdbc@arkaria.postgresql.org; Wed, 20 Jul 2016 14:56:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bPsuX-0008HS-UD for pgsql-jdbc@postgresql.org; Wed, 20 Jul 2016 14:55:45 +0000 Received: from plane.gmane.org ([80.91.229.3]) by magus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bPsuT-0006Tf-2P for pgsql-jdbc@postgresql.org; Wed, 20 Jul 2016 14:55:45 +0000 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1bPsuR-00026W-5d for pgsql-jdbc@postgresql.org; Wed, 20 Jul 2016 16:55:39 +0200 Received: from 185.40.248.10 ([185.40.248.10]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 20 Jul 2016 16:55:39 +0200 Received: from spam_eater by 185.40.248.10 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 20 Jul 2016 16:55:39 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-jdbc@postgresql.org From: Thomas Kellerer Subject: Re: ResultSet.getClob() causing problems when used with JPA's @Lob Date: Wed, 20 Jul 2016 16:55:26 +0200 Lines: 18 Message-ID: References: <201102070001.22259.andreak@officenet.no> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 185.40.248.10 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 In-Reply-To: X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org Vladimir Sitnikov schrieb am 20.07.2016 um 15:52: > 2) > Thomas>I don't think checking the column type is necessary (at least not for me). > Thomas>If this option is enabled, then all calls to getClob() are simply "re-routed" to getString(). > > I'm afraid you miss the point. > > In postgresql world, there's "large object API": https://www.postgresql.org/docs/current/static/lo-interfaces.html > pgjdbc wraps that, so if you have a column of "oid" type, then you can access the value via getClob and pgjdbc would reroute the calls to large object API. I am aware of the large object API but for the intended use case of "treatClobAsString=true" this would simply not support storing string values through large objects - and I doubt that any project that would actually use "treatClobAsString=true" would mix CLOBs as "large objects" and CLOBs as "text". > So getLong is not a mistake in getClob. getLong is here to retrieve the value of "large object oid" (i.e. pointer). > That is why column type is crucial to tell if getClob is dealing with "large object API" or "just a string". If we look at the use-case for this "override", I'm pretty sure there are (a lot) more people that could benefit from an unconditional getClob() == getString() then people that actually need the distinction because they store large text data as "large objects" (oid columns): Thomas -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc