Обсуждение: Deleting a list of external xinv/xinx files using JDBC

Поиск
Список
Период
Сортировка

Deleting a list of external xinv/xinx files using JDBC

От
xriley@encryptix.com
Дата:
I'm using the JDBC setBytes to insert a list of large object blobs. 
The side-effect of this is two external files (xinvOID and xinxOID)
for every blob inserted.
 
If I use a JDBC delete sql statement to delete the records
containing the blobs,  the external xin* files are not deleted.
 
Is this by design? If so, is there a work around for deleting
a LIST of records AND the associated external blob file?
 
 
Foe example:
    CREATE TABLE "some_blobs" (
        "blob_id" int4 PRIMARY KEY,
        "the_blob" oid NOT NULL
     );
 
    JDBC insert statement for adding blob records:
        insert into some_blobs (blob_id, the_blob) values (?,?)
 
    JDBC delete statement for removing all blob records:
        delete from some_blobs
 
Thanks
Xavier

Re: Deleting a list of external xinv/xinx files using JDBC

От
Peter T Mount
Дата:
Quoting xriley@encryptix.com:

> I'm using the JDBC setBytes to insert a list of large object blobs.  
> The side-effect of this is two external files (xinvOID and xinxOID) 
> for every blob inserted.
>  
> If I use a JDBC delete sql statement to delete the records
> containing the blobs,  the external xin* files are not deleted.
>  
> Is this by design? If so, is there a work around for deleting
> a LIST of records AND the associated external blob file?

Yes this is by design (in the backend) as there is no real link between your 
table and the blob. If you look under /contrib you will find ways of fixing 
this using triggers that watch your table and when a row containing a blob is 
deleted or the blob amended then the old blob is deleted in the background.

Peter

-- 
Peter Mount peter@retep.org.uk
PostgreSQL JDBC Driver: http://www.retep.org.uk/postgres/
RetepPDF PDF library for Java: http://www.retep.org.uk/pdf/