Thread: Dangling large objects

Dangling large objects

From
Adam Haberlach
Date:
    I'm in a bit of a bind here.  I wrote some code in our abstraction
layer to automatically unlink large objects when the row referencing
them is deleted (I know that they are only referenced once).  However,
I neglected to include them in a transaction, so I'm pretty sure that
those unlinks never happened.

    Is there any simple way for me to get a list of all large objects
in a database, so I can see if there are actually rows referring to them
and delete the ones that were not unlinked earlier?

--
Adam Haberlach            |A cat spends her life conflicted between a
adam@newsnipple.com       |deep, passionate, and profound desire for
http://www.newsnipple.com |fish and an equally deep, passionate, and
'88 EX500                 |profound desire to avoid getting wet.

Re: Dangling large objects

From
Tom Lane
Date:
Adam Haberlach <adam@newsnipple.com> writes:
>     Is there any simple way for me to get a list of all large objects
> in a database, so I can see if there are actually rows referring to them
> and delete the ones that were not unlinked earlier?

Look at the vacuum_lo contrib module.

BTW, I believe lo_unlink doesn't need to be in a transaction block,
only lo_open/read/write/close do.

            regards, tom lane

Re: Dangling large objects

From
"Brett W. McCoy"
Date:
Dangling large objects?  I thought this was a family list. :-)

-- Brett

PS. Sorry, couldn't resist...

                                     http://www.chapelperilous.net/~bmccoy/
---------------------------------------------------------------------------
Unnamed Law:
    If it happens, it must be possible.