Re: [GENERAL] Removing large objects from the db (Q at bottom)

From: "David Hartwig" <daybee(at)bellatlantic(dot)net>
To: <jagged(at)shaitan(dot)demiurge(dot)org>, <pgsql-general(at)hub(dot)org>
Subject: Re: [GENERAL] Removing large objects from the db (Q at bottom)
Date: 1998-12-31 16:26:54
Message-ID: 001b01be34da$6265b4a0$c17dc497@daveh
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Check the contrib directory. I believe it was Peter who put together a set
of functions and and SQL triggers to help manage this problem.

----- Original Message -----
From: <jagged(at)shaitan(dot)demiurge(dot)org>
To: <pgsql-general(at)hub(dot)org>
Sent: Wednesday, December 30, 1998 1:10 PM
Subject: [GENERAL] Removing large objects from the db (Q at bottom)

>Let's say you've got the following relation in a database:
>
>CREATE TABLE foo (
> descr VARCHAR(32),
> content OID
>);
>
>and you do a
>
>INSERT INTO foo (descr, content)
> VALUES ('obj1', lo_import('/tmp/bar.txt'));
>
>then you'll have one tuple in your relation with the oid of the imported
>'bar.txt' in the content column, so if you were to do a
>
>SELECT * FROM foo;
>
>you might get something that looks like
>
>descr|content
>-----+-------
>obj1 | 166219
>(1 row)
>
>Now, if you do a
>
>DELETE FROM foo WHERE descr = 'obj1';
>
>you'll wind up deleting the tuple in foo, but if you do a
>
>SELECT lo_export(166219, '/tmp/frotz.txt');
>
>you'll find that the large object is still in the database, which makes
>sense, since you're only deleting a pointer to the lo. I apologise for the
>pedantry -- I just wanted to make sure that I was on solid ground before I
>asked what will very probably be a silly question: How do you delete a
>large object from the database? I didn't see a built in function, and there
>wasn't anything in section 15 of the programmer's manual.
>

Browse pgsql-general by date

  From Date Subject
Next Message Dalphin, Mark 1998-12-31 17:57:42 RE: Removing large objects from the db (Q at bottom)
Previous Message Jose' Soares 1998-12-31 09:05:34 Re: [GENERAL] 88, CREATE FUNCTION ON TABLE