X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EC9B1DA65A for ; Sat, 8 Oct 2005 08:20:06 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12408-05 for ; Sat, 8 Oct 2005 11:20:01 +0000 (GMT) Received: from qproxy.gmail.com (qproxy.gmail.com [72.14.204.206]) by svr1.postgresql.org (Postfix) with ESMTP id 7F655DA644 for ; Sat, 8 Oct 2005 08:20:02 -0300 (ADT) Received: by qproxy.gmail.com with SMTP id e12so789971qbe for ; Sat, 08 Oct 2005 04:20:05 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=lLnhPfp9aRkgzYr2AvX80lA20t1waOEQYxHgB6eCNV/vq0gENkAQNZKAU7LS7ZNTykp+URhLJkPDvWr+9ajQTh9nQQlSxU84Ssv5245OqlAYRZ5nPw4Q6mOAbnzi597jmQ6p35/6juAc4Y7n1EjCPr5TXyEN4RqbJdCzP0dbDG8= Received: by 10.65.154.13 with SMTP id g13mr2030614qbo; Sat, 08 Oct 2005 04:20:05 -0700 (PDT) Received: by 10.65.115.7 with HTTP; Sat, 8 Oct 2005 04:20:05 -0700 (PDT) Message-ID: <7104a7370510080420qca482a5r23ce3fdff80d25e1@mail.gmail.com> Date: Sat, 8 Oct 2005 14:20:05 +0300 From: Volkan YAZICI To: Richard Huxton Subject: Re: How to delete Large Object from Database? Cc: Premsun Choltanwanich , pgsql-sql@postgresql.org In-Reply-To: <434623FD.7000408@archonet.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <43465BAA.C5F7.004C.0@nsasia.co.th> <434623FD.7000408@archonet.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.856 required=5 tests=[RCVD_BY_IP=0.024, RCVD_IN_BL_SPAMCOP_NET=1.832] X-Spam-Level: * X-Archive-Number: 200510/74 X-Sequence-Number: 22927 Hi, On 10/7/05, Richard Huxton wrote: > Deleting the OID does not remove the object itself - see details of > lo_unlink() in Chapter 28 of the manuals. > > I seem to recall some other utilities in the contrib/ directory of the > source distribution too. Could it be `contrib/lo'? Here's some snippet from contrib/lo/README.lo: [Snippet] One of the problems with the JDBC driver (and this affects the ODBC driver also), is that the specification assumes that references to BLOBS (Binary Large OBjectS) are stored within a table, and if that entry is changed, the associated BLOB is deleted from the database. As PostgreSQL stands, this doesn't occur. Large objects are treated as objects in their own right; a table entry can reference a large object by OID, but there can be multiple table entries referencing the same large object OID, so the system doesn't delete the large object just because you change or remove one such entry. [...] I've fixed this by creating a new data type 'lo', some support functions, a= nd a Trigger which handles the orphaning problem. The trigger essentially jus= t does a 'lo_unlink' whenever you delete or modify a value referencing a larg= e object. When you use this trigger, you are assuming that there is only one database reference to any large object that is referenced in a trigger-controlled column! [/Snippet] Regards.