pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-jdbc@postgresql.org
Subject: Re: ResultSet.getClob() causing problems when used with JPA's @Lob
Date: Fri, 29 Jul 2016 08:07:43 +0200
Message-ID: <nnerrf$rkg$1@ger.gmane.org> (raw)
In-Reply-To: <CAB=Je-H95w8RC86G18m2RMLWU9yxLfqmwHWFesfmAC9GuxmEsg@mail.gmail.com>
References: <201102070001.22259.andreak@officenet.no>
	<nmnoj4$ouq$1@ger.gmane.org>
	<nnb1h7$hgm$1@ger.gmane.org>
	<CAB=Je-FbszwjAFVYfr+DiGgS8dOhsOFTGK65=d7VyjPAHdnyvQ@mail.gmail.com>
	<nndpn0$jv4$2@ger.gmane.org>
	<CAB=Je-EWdfRaS4X3x=txQtLKRm2rOy1xE91t=4v2cD4KtNpdmQ@mail.gmail.com>
	<nnds7r$ao2$1@ger.gmane.org>
	<CAB=Je-H95w8RC86G18m2RMLWU9yxLfqmwHWFesfmAC9GuxmEsg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>

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-...

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



view thread (36+ messages)

Message-ID: <nnerrf$rkg$1@ger.gmane.org>
Permalink:  ../nnerrf$rkg$1@ger.gmane.org/
Also on:    postgresql.org/message-id/nnerrf$rkg$1@ger.gmane.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: spam_eater@gmx.net
  Subject: Re: ResultSet.getClob() causing problems when used with JPA's @Lob
  In-Reply-To: <nnerrf$rkg$1@ger.gmane.org>
  References: <201102070001.22259.andreak@officenet.no> <nmnoj4$ouq$1@ger.gmane.org> <nnb1h7$hgm$1@ger.gmane.org> <CAB=Je-FbszwjAFVYfr+DiGgS8dOhsOFTGK65=d7VyjPAHdnyvQ@mail.gmail.com> <nndpn0$jv4$2@ger.gmane.org> <CAB=Je-EWdfRaS4X3x=txQtLKRm2rOy1xE91t=4v2cD4KtNpdmQ@mail.gmail.com> <nnds7r$ao2$1@ger.gmane.org> <CAB=Je-H95w8RC86G18m2RMLWU9yxLfqmwHWFesfmAC9GuxmEsg@mail.gmail.com> <nnerrf$rkg$1@ger.gmane.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox