Обсуждение: Deleting LargeObjects as BLOBS

Поиск
Список
Период
Сортировка

Deleting LargeObjects as BLOBS

От
Jason Blumenkrantz
Дата:
Hi all,

I'm currently investigating using the LargeObject facility to store user
uploaded files of size up to 2GB directly in the database. However, I'm
currently using a JDBC intermediate driver on top of the Postgres JDBC
driver (Sequoia) to do data replication, so I'm tied to using the pure
JDBC specification and unable to use the LargeObjectManager directly.
I'm using getBlob() and setBlob() in order to store and retrieve my File
objects, which all works fine. However, when I delete the row from my
data table. the data isn't being deleted from the pg_largeobject table.
Should I be deleting from the pg_largeobject table myself after
retrieving the LOID from my own table, or is there a more proper way to
do this? I'm using server version 8.0.9 and driver version 8.0-320.

Thanks,
Jason Blumenkrantz


Re: Deleting LargeObjects as BLOBS

От
Kris Jurka
Дата:

On Thu, 10 Jan 2008, Jason Blumenkrantz wrote:

> [how do I auto delete a blob when the row referring to it goes away]

The easiest thing to do is to define an AFTER DELETE trigger on your table
to cleanup the LO when the row goes away.

Kris Jurka