Thread

  1. About oids

    Philip Bierhoff <flip@win.tue.nl> — 1998-05-23T12:22:19Z

    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'
    
    Thanks in advance
    
    Philip
    
    
  2. Re: [GENERAL] About oids

    Peter Mount <pgsqlgen@retep.org.uk> — 1998-05-26T20:20:43Z

    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