Re: Synchronize filenames in table with filesystem - Mailing list pgsql-general

From Steve Atkins
Subject Re: Synchronize filenames in table with filesystem
Date
Msg-id 66D7408F-D6E2-4E76-979E-F3F14670BC1F@blighty.com
Whole thread Raw
In response to Synchronize filenames in table with filesystem  (Ludwig Kniprath <ludwig@kni-online.de>)
Responses Re: Synchronize filenames in table with filesystem  ("Bret" <bret_stern@machinemanagement.com>)
List pgsql-general
On Dec 1, 2009, at 9:19 AM, Ludwig Kniprath wrote:

> Hi List,
> not another question on how to store files (db or filesystem), i decided to use the filesystem.
>
> I'm now searching for a trigger, that deletes the physical file when deleting a database-record containing the
filenamein one of its fields. Is there a sample somewhere how this could be done? I'm runnig PG 8.4 on a windows
machine.

I've done that by having the trigger put the name of the file to be deleted in a "to be deleted" table. Then an
externalprocess polls that table and deletes any file it finds in there (using listen/notify if you need that to happen
immediately,but just polling works fine if it's just garbage collection). 

That has the advantage of not deleting files until the transaction commits too.

Cheers,
  Steve


pgsql-general by date:

Previous
From: Richard Broersma
Date:
Subject: Re: Synchronize filenames in table with filesystem
Next
From: Robert Haas
Date:
Subject: Re: [HACKERS] Fwd: psql+krb5