Re: How to delete Large Object from Database? - Mailing list pgsql-sql

From Volkan YAZICI
Subject Re: How to delete Large Object from Database?
Date
Msg-id 7104a7370510080420qca482a5r23ce3fdff80d25e1@mail.gmail.com
Whole thread Raw
In response to Re: How to delete Large Object from Database?  (Richard Huxton <dev@archonet.com>)
List pgsql-sql
Hi,

On 10/7/05, Richard Huxton <dev@archonet.com> wrote:
> Deleting the OID does not remove the object itself - see details of
> lo_unlink() in Chapter 28 of the manuals.
>
> I seem to recall some other utilities in the contrib/ directory of the
> source distribution too.

Could it be `contrib/lo'? Here's some snippet from contrib/lo/README.lo:

[Snippet]
One of the problems with the JDBC driver (and this affects the ODBC driver
also), is that the specification assumes that references to BLOBS (Binary
Large OBjectS) are stored within a table, and if that entry is changed, the
associated BLOB is deleted from the database.

As PostgreSQL stands, this doesn't occur.  Large objects are treated as
objects in their own right; a table entry can reference a large object by
OID, but there can be multiple table entries referencing the same large
object OID, so the system doesn't delete the large object just because you
change or remove one such entry.

[...]

I've fixed this by creating a new data type 'lo', some support functions, and
a Trigger which handles the orphaning problem.  The trigger essentially just
does a 'lo_unlink' whenever you delete or modify a value referencing a large
object.  When you use this trigger, you are assuming that there is only one
database reference to any large object that is referenced in a
trigger-controlled column!
[/Snippet]

Regards.


pgsql-sql by date:

Previous
From: solarsail
Date:
Subject: Re: using pg_tables and tablename in queries
Next
From: Simon Law
Date:
Subject: convert time