Re: [GENERAL] About oids - Mailing list pgsql-general

From Peter Mount
Subject Re: [GENERAL] About oids
Date
Msg-id Pine.LNX.3.95.980526211553.2905A-100000@retep.org.uk
Whole thread Raw
In response to About oids  (Philip Bierhoff <flip@win.tue.nl>)
List pgsql-general
On Sat, 23 May 1998, Philip Bierhoff wrote:

> Hello,
>
> I can't find any documentation on this in manuals and FAQ. I store some
> files in a database, which I access through JDBC from a Java application.
> Now I want to delete some of these entries. Issuing
>
>  DELETE FROM files
>
> does only remove the oids from the table, but the file still remains on my
> disk (I checked the data/base/ dir and the "xinv" and "xinx" files are
> still there.). I did some research and found out that the function
> lo_unlink removes the files. However, the parameter of lo_unlink is an int4,
> and not an oid. There is no function to convert oid to int4.
>
> So, can someone tell me how I should implement a (non working) query like
> this:
>
>  SELECT lo_unlink(f) FROM files WHERE title = 'test.txt'

The ImageViewer example does this by deleting the row from the table, then
issuing the lo_unlink() seperately.

You can also do this using triggers, but you have to define the trigger
in C, declare it for each table, and it doesn't support inheritance.

It's on the TODO list (and claimed by me), for a proper large object type,
 so that the DELETE FROM files query will delete the large object at the
same time.

--
Peter T Mount peter@retep.org.uk or petermount@earthling.net
Main Homepage: http://www.retep.org.uk
************ Someday I may rebuild this signature completely ;-) ************
Work Homepage: http://www.maidstone.gov.uk Work EMail: peter@maidstone.gov.uk


pgsql-general by date:

Previous
From: Herouth Maoz
Date:
Subject: Re: [GENERAL] Mirror Sites...
Next
From: Ricardo Romero
Date:
Subject: PERL connecting on PostgreSQL