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: Wed, 20 Jul 2016 16:55:26 +0200
Message-ID: <nmo3cu$bur$1@ger.gmane.org> (raw)
In-Reply-To: <CAB=Je-F7KnH7ogBhsVhk0mo-KTO-WOOyX52s5DeMFspa6bKC_A@mail.gmail.com>
References: <201102070001.22259.andreak@officenet.no>
	<nmnoj4$ouq$1@ger.gmane.org>
	<CAB=Je-FBJgyP5xbpcBAVBc84k2YW82-T2zrYFaD-kBhoN1dFwA@mail.gmail.com>
	<nmnv15$1dl$1@ger.gmane.org>
	<CAB=Je-F7KnH7ogBhsVhk0mo-KTO-WOOyX52s5DeMFspa6bKC_A@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>

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



view thread (36+ messages)  latest in thread

Message-ID: <nmo3cu$bur$1@ger.gmane.org>
Permalink:  ../nmo3cu$bur$1@ger.gmane.org/
Also on:    postgresql.org/message-id/nmo3cu$bur$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: <nmo3cu$bur$1@ger.gmane.org>
  References: <201102070001.22259.andreak@officenet.no> <nmnoj4$ouq$1@ger.gmane.org> <CAB=Je-FBJgyP5xbpcBAVBc84k2YW82-T2zrYFaD-kBhoN1dFwA@mail.gmail.com> <nmnv15$1dl$1@ger.gmane.org> <CAB=Je-F7KnH7ogBhsVhk0mo-KTO-WOOyX52s5DeMFspa6bKC_A@mail.gmail.com> <nmo3cu$bur$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