From: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
To: Dave Cramer <davecramer@postgres.rocks>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: BLOB / CLOB support in PostgreSQL
Date: Tue, 29 Sep 2020 15:29:26 -0400
Message-ID: <b3aff2ee-9483-f32f-4b86-ad7f7c260ae7@2ndQuadrant.com> (raw)
In-Reply-To: <CADK3HH+17+uNA=oWbJVweS4BzR_wUt-0KNUAsawP_EJ7QfYtVw@mail.gmail.com>
References: <CAB=Je-EN_Wc-SURAfUAgzLh-kcmxD_migPaO1Jx+SksTAMEuog@mail.gmail.com>
<CAB=Je-GadTt1EJJ9Nxhkz6cDtj=1SxtRiKmRq1e8vTViGGEh9A@mail.gmail.com>
<6570918c-7776-d217-6e15-52e8006cf15f@2ndquadrant.com>
<be2f74bc-8915-3cb3-96f3-47cd89cf10c8@2ndQuadrant.com>
<CADK3HH+17+uNA=oWbJVweS4BzR_wUt-0KNUAsawP_EJ7QfYtVw@mail.gmail.com>
On 9/29/20 2:39 PM, Dave Cramer wrote:
>
>
> On Tue, 29 Sep 2020 at 14:33, Andrew Dunstan
> <andrew.dunstan@2ndquadrant.com
> <mailto:andrew.dunstan@2ndquadrant.com>> wrote:
>
>
> On 9/29/20 10:26 AM, Peter Eisentraut wrote:
> > On 2020-09-28 15:46, Vladimir Sitnikov wrote:
> >> The concerns to avoid "Clob maps to text" could be:
> >> a) Once the behavior is implemented, it is hard to change. That is
> >> applications would rely on it (and it becomes a defacto standard),
> >> and it would be hard to move to the proper "text with streaming
> API"
> >> datatype.
> >> b) If we make «clob is text», then people might start using
> >> update/substring APIs (which is the primary motivation for Clob)
> >> without realizing there’s full value update behind the scenes.
> >> Currently, they can use setString/getString for text, and it is
> >> crystal clear that the text is updated fully on every update.
> >
> > When we added TOAST, we made the explicit decision to not add a
> "LONG"
> > type but instead have the toasting mechanism transparent in all
> > variable-length types. And that turned out to be a very successful
> > decision, because it allows this system to be used by all data
> types,
> > not only one or two hardcoded ones. Therefore, I'm very strongly of
> > the opinion that if a streaming system of the sort you allude to
> were
> > added, it would also be added transparently into the TOAST system.
> >
> > The JDBC spec says
> >
> > """
> > An implementation of a Blob, Clob or NClob object may either be
> > locator based or result in the object being fully materialized
> on the
> > client.
> >
> > By default, a JDBC driver should implement the Blob, Clob and NClob
> > interfaces using the appropriate locator type. An application
> does not
> > deal directly with the locator types that are defined in SQL.
> > """
> >
> > (A "locator" in SQL is basically what you might call a streaming
> handle.)
> >
> > So yes, this encourages the implementation of locators. But it also
> > specifies that if you don't have locators, you can implement this
> > using non-large-object types.
> >
> >
>
> So if I read this correctly what I have proposed is completely kosher
> according to the spec - it's the "fully materialized on the client"
> variant, just like the MySQL and MSSQL drivers.
>
>
> I haven't really looked at MySQL or MSSQL but do they implement the
> full CLOB API ?
> We would need to implement the full API.
>
> BTW, just because it adheres to the spec doesn't seem to hold water in
> the PostgreSQL project. Just sayin'
>
>
I take your point, but my remark was more in response to the apparent
suggestion that what I submitted was not according to spec.
There are two Clob methods I didn't implement, and one Blob method - the
set*Stream methods, I think they should be implementable, but they will
make the implementation somewhat more complex.
Anyway, at this stage let's take the discussion back to the github forums.
cheers
andrew
--
Andrew Dunstan https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
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: andrew.dunstan@2ndquadrant.com, davecramer@postgres.rocks, peter.eisentraut@2ndquadrant.com, sitnikov.vladimir@gmail.com, pgsql-hackers@lists.postgresql.org
Subject: Re: BLOB / CLOB support in PostgreSQL
In-Reply-To: <b3aff2ee-9483-f32f-4b86-ad7f7c260ae7@2ndQuadrant.com>
References: <CAB=Je-EN_Wc-SURAfUAgzLh-kcmxD_migPaO1Jx+SksTAMEuog@mail.gmail.com> <CAB=Je-GadTt1EJJ9Nxhkz6cDtj=1SxtRiKmRq1e8vTViGGEh9A@mail.gmail.com> <6570918c-7776-d217-6e15-52e8006cf15f@2ndquadrant.com> <be2f74bc-8915-3cb3-96f3-47cd89cf10c8@2ndQuadrant.com> <CADK3HH+17+uNA=oWbJVweS4BzR_wUt-0KNUAsawP_EJ7QfYtVw@mail.gmail.com> <b3aff2ee-9483-f32f-4b86-ad7f7c260ae7@2ndQuadrant.com>
* 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