Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bT0yB-0000tK-Je for pgsql-jdbc@arkaria.postgresql.org; Fri, 29 Jul 2016 06:08:27 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bT0yB-00058n-6h for pgsql-jdbc@arkaria.postgresql.org; Fri, 29 Jul 2016 06:08:27 +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 1bT0xg-0004Rz-OS for pgsql-jdbc@postgresql.org; Fri, 29 Jul 2016 06:07:56 +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 1bT0xZ-0005fT-90 for pgsql-jdbc@postgresql.org; Fri, 29 Jul 2016 06:07:54 +0000 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1bT0xY-0006Lo-I3 for pgsql-jdbc@postgresql.org; Fri, 29 Jul 2016 08:07:48 +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 ; Fri, 29 Jul 2016 08:07:48 +0200 Received: from spam_eater by 185.40.248.10 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 29 Jul 2016 08:07:48 +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: Fri, 29 Jul 2016 08:07:43 +0200 Lines: 41 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 29.07.2016 um 00:20: >>other JDBC implementations. > > I've just looked into PgConnection.createClob, and it turns out the method is not implemented. > This means no one ever used that to pass strings into large objects or whatever thing. I noticed that as well. I wonder if we could use the PgStringClob and PgStringBlob I included with my patch for that purpose? I think the missing methods in those two classes shouldn't be that hard to implement. > Large object API works with bytes, not characters, so I think we can > safely assume that PgPreparedStatement.setClob results into string > datatype (that is it should be just redirected to setString). > > This (plus the patch that enables to getClob for textual results) should solve the problem for the majority of pgjdbc users. > > Thomas is that enough so you can give it a try? Redirecting setClob() to setString() unconditionally would help us in the current migration, yes. I can submit a patch for that, sounds easy enough. > That's really a pity, because the (very unusual) handling of "large objects" makes the Clob/Blob handling quite > incompatiable with other JDBC implementations. > > The problem with Blob remains (I'm not sure if you have one): > postgresql cannot automatically create a large object when it receives "bytea" bind. > > The same "unknown" approach does not work here since "large objects" are stored aside and a colum contains just a "oid" (64bit id). > > That adds yet another case "bytea vs large object" to > https://github.com/pgjdbc/pgjdbc/blob/master/backend_protocol_v4_wanted_features.md#binary-transfer-vs-exact-data-type I still think that having a connection property that switches between large objects and bytea for BLOBs makes sense. Thomas -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc