Search Postgresql Archives

Re: Synchronize filenames in table with filesystem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 filename in 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 external process 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


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux