From: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
---|---|
To: | Oisin Glynn <me(at)oisinglynn(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: File System Access: |
Date: | 2006-09-27 15:58:13 |
Message-ID: | 20060927155812.GD13693@svana.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, Sep 27, 2006 at 11:15:19AM -0400, Oisin Glynn wrote:
> All,
>
> I have a need to create/copy/delete files on my server from a function
> in PostreSql. I am running 8.x PostreSql on Windows 200x and my
> functions etc are currently only in PL/pgSQL. Is there a way to create
> files/copy them and delete them from PL/pgSQL or could i call an
> external bat file job from PL/pgSQL.
Nope, for that you need an untrusted language like pl/perlu.
> I had thought about having a table with a list of operations and then
> scheduling a job in the OS to call and execute them but these operations
> need to happen in real time.
This is a better approach. Have a daemon that permanently attaches to
the database and executes a LISTEN. Then when someone else adds a row
to the table, it executes a NOTIFY, the daemon will get told and can do
the work.
LISTEN/NOTIFY is pretty much instantaneous, and you have a backup plan
(if copy/create/update fails for some reason, leave the row in the
table and try again later).
Hope this helps,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.
From | Date | Subject | |
---|---|---|---|
Next Message | Joost Kraaijeveld | 2006-09-27 16:04:45 | Re: Strange query results with invalid multibyte |
Previous Message | Hakan Kocaman | 2006-09-27 15:44:12 | Re: Fulltext index in postgres? |