Re: BLOB / CLOB support in PostgreSQL

From: Vladimir Sitnikov <sitnikov(dot)vladimir(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: BLOB / CLOB support in PostgreSQL
Date: 2020-09-28 13:46:43
Message-ID: CAB=Je-GadTt1EJJ9Nxhkz6cDtj=1SxtRiKmRq1e8vTViGGEh9A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

Let me please bump the thread.

Just in case, I'm PgJDBC committer.

PgJDBC receives requests to "support CLOB" from time to time, however, I
believe it is impossible without the support from the database.
To my best knowledge, the database does not have APIs for "streaming large
text data".
The only "streaming large binary data" API I know is LargeObject which
seems to be old-fashioned.

I believe Java is not the only client that wants streaming access for
binary and text data.

Here's a recent pull request to PgJDBC
https://github.com/pgjdbc/pgjdbc/pull/1892 where Andrew suggests to add
BLOB/CLOB support via bytea/text,
and apparently, Andrew is surprised that the database lacks BLOB/CLOB
support.

Any ideas on the way to proceed here?
I don't think it is right to implement Clob via text, especially in case
the database provides its own "large text with streaming" datatype in the
future.

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.

Vladimir

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2020-09-28 13:56:10 Re: a problem about XLogReader callback system
Previous Message Thomas Kellerer 2020-09-28 13:17:37 Re: Partition prune with stable Expr

Browse pgsql-jdbc by date

  From Date Subject
Next Message Andrew Dunstan 2020-09-28 16:43:39 Re: Support for OUT parameters in procedures
Previous Message Dave Cramer 2020-09-20 23:57:51 [pgjdbc/pgjdbc] 93d8b6: fix checkstyle (#1888)