Thread: How to back up large objects?

How to back up large objects?

From
Chris Carbaugh
Date:
I can't seem to figure out how to back up the large ogjects I have in my
DB.

Here's the situation:

I insert a large object (via PHP) into my DB.  I also insert a record
into a table that uses the OID of the LO I inserted.  I later expect to
pull the record out of the table, get the OID I stored of the LO, and
then export that object.

The question is:  How do I backup the database including the large
objects?  pg_dump doesn't seem to help me here.  The only way I have
seen to access a large object is teh /lo_export command in psql.

so what is the common usage of large objects?

My main goal is a method of backing up a database that conists of a
table that stores the OID of the large objects, the large objects
themselves, and then restoring all of this to a new DB (whether it's on
the same machine or a different one).  MInd you I have to have the
large objects maintain their origianl OID.

Any input appreciated.

Chris

--
"I think your slogan 'Liberty or Death' is splendid, and whichever one
you decide on will be all right with me."  - Alexander Woollcott


Re: How to back up large objects?

From
KuroiNeko
Date:
 Chris,

> I can't seem to figure out how to back up the large ogjects I have in my
> DB.

 No way to do this with pg_dump. At least AFAIK. You need something custom,
or just backup the whole DB dir at file level.

> so what is the common usage of large objects?

 Well, you  asked.... :) Personally  I see absolutely  no use for  BLOBs in
99.9% of  cases. As  long as BLOBs  can not be  indexed, searching  on them
makes no sense, and they remain mostly a marketing ploy. Yes, one can put a
whole 2.5 MB AVI clip in a BLOB, but who really needs that? As long as they
are stored  off-page, there's always  some `pumping' involved  (PGSQL basic
functions to  import/export BLOBs do  this) So, if  you can't use  it until
it's converted to a file, why don't keep it as a file all the time?
 This is a personal opinion and I don't claim to posess the final truth.

> My main goal is a method of backing up a database that conists of a
> table that stores the OID of the large objects, the large objects
> themselves

# tar -cf mydb.tar mydb

 Works like a champ ;)

 Ed


--

 Well I tried to be meek
  And I have tried to be mild
 But I spat like a woman
  And I sulked like a child
 I have lived behind the walls
  That have made me alone
 Striven for peace
  Which I never have known

 Dire Straits, Brothers In Arms, The Man's Too Strong (Knopfler)