Re: [HACKERS] text should be a blob field - Mailing list pgsql-hackers

From Peter T Mount
Subject Re: [HACKERS] text should be a blob field
Date
Msg-id Pine.LNX.3.95.980303195117.25913C-100000@maidast
Whole thread Raw
In response to Re: [HACKERS] text should be a blob field  (Bruce Momjian <maillist@candle.pha.pa.us>)
Responses Re: [QUESTIONS] Re: [HACKERS] text should be a blob field
List pgsql-hackers
On Tue, 3 Mar 1998, Bruce Momjian wrote:

> > make text a blob datatype (maybe storing <= 8k row with tuple, >=8k in blob
> > tablespace)
>
> Hmmm.
>

There was some talk about this about a month ago.

Although we now have blob support in the JDBC driver, there is one
outstanding issue with them, that I was waiting for 6.3 to be released
before starting on it (and almost certainly starting a discussion here
about it).

Allowing text to use blobs for values larger than the current block size
would hit the same problem.

Ok, here's what the problem is at the moment:

The JDBC example ImageViewer uses a table to store the name of an image,
and the OID of the associated blob.

# create table images (imgname name,imgoid oid);

Ok, we now create an entry in the table for an image with:

# insert into images values ('test.gif',lo_import('/home/pmount/test.gif'));

This is fine so far. Now say we delete that row with:

# delete from images where name = 'test.gif';

Fine again, except that the blob is still in the database. To get round
this, you would have to add extra statements to handle this, and for JDBC,
there is no standard way to do this.

What I was thinking of, was to create a new type 'blob' which would delete
the associated large object when the row is deleted. However, here's the
problems against this:

1. Is there a call made by the backend to each datatype when a row is
   deleted? I can't see one.

2. When we update a row, we don't want the overhead of copying a very
   large blob when a row is first copied, then the original deleted, etc.

Anyhow, I'm thinking of various ways around this - just don't hold your
breath ;-)

--
Peter T Mount  petermount@earthling.net or pmount@maidast.demon.co.uk
Main Homepage: http://www.demon.co.uk/finder
Work Homepage: http://www.maidstone.gov.uk Work EMail: peter@maidstone.gov.uk


pgsql-hackers by date:

Previous
From: Zeugswetter Andreas SARZ
Date:
Subject: AW: [HACKERS] text should be a blob field
Next
From: Peter T Mount
Date:
Subject: Re: [HACKERS] backend -> interface communication