Skip site navigation (1) Skip section navigation (2)

Re: [GENERAL] About oids

From: Peter Mount <pgsqlgen(at)retep(dot)org(dot)uk>
To: Philip Bierhoff <flip(at)win(dot)tue(dot)nl>
Cc: pgsql-general(at)hub(dot)org
Subject: Re: [GENERAL] About oids
Date: 1998-05-26 20:20:43
Message-ID: Pine.LNX.3.95.980526211553.2905A-100000@retep.org.uk (view raw, whole thread or download thread mbox)
Thread:
Lists: 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(at)retep(dot)org(dot)uk or petermount(at)earthling(dot)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(at)maidstone(dot)gov(dot)uk


In response to

  • About oids at 1998-05-23 12:22:19 from Philip Bierhoff

pgsql-general by date

Next:From: Ricardo RomeroDate: 1998-05-26 22:20:02
Subject: PERL connecting on PostgreSQL
Previous:From: Peter T MountDate: 1998-05-26 20:12:09
Subject: Re: [GENERAL] RE: [HACKERS] error messages not only English

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group