Re: Synchronize filenames in table with filesystem

Поиск
Список
Период
Сортировка
Искать
От
Richard Broersma
Тема
Re: Synchronize filenames in table with filesystem
Дата
Msg-id
396486430912010934j62f9227ew63f0c67d1592571d@mail.gmail.com
Ответ на
Список
Дерево обсуждения
Synchronize filenames in table with filesystem Ludwig Kniprath <ludwig@kni-online.de>
Re: Synchronize filenames in table with filesystem Richard Broersma <richard.broersma@gmail.com>
Re: Synchronize filenames in table with filesystem Steve Atkins <steve@blighty.com>
Re: Synchronize filenames in table with filesystem "Bret" <bret_stern@machinemanagement.com>
Re: Synchronize filenames in table with filesystem silly8888 <silly8888@gmail.com>
On Tue, 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.


Perhaps when you delete your record, you can use a before delete
trigger to insert this path to a "Files_To_Delete" table.  Then using
Cron, you can query this table to get the list of file you want to
delete.

On the other hand, if you really want to delete each file with a
trigger, you are probably better off using Large Objects (lo):
http://www.postgresql.org/docs/8.4/interactive/lo.html

And in the off chance that you one day use the truncate command you
can periodically schedule the vacuumlo command:
http://www.postgresql.org/docs/8.4/interactive/vacuumlo.html

-- 
Regards,
Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug
В списке pgsql-general по дате отправления
От: Ludwig Kniprath
Дата:
От: Steve Atkins
Дата:
FAQ