Armand....
On Thu, Sep 29, 2016 at 11:41 PM, Armand Pirvu (home)
<armand.pirvu@gmail.com> wrote:
> I know this may sound like heresy since it involves executing an OS command from a function , but here goes
> After an insert in a table, I want to touch a file
....
> I used plsh extension but I had to use two functions and a trigger, see code below
....
> It works but can I be simpler ? Any other alternatives ? In Ingres for example I can use dbevent and an esqlc app
whichlistens
If you are superuser ( which I supose you must be to execute plsh )
you could try to put code like this in a plpgsql, or may be even sql,
security definer ( or plain if not needed ) function:
( slighly sanitized )
In the psql prompt of a client machine:
n=# copy (select 1 as c where false) to '/tmp/ptxtst';
COPY 0
In the server machine:
postgres@server ~ $ stat /tmp/ptxtst
File: '/tmp/ptxtst'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 802h/2050d Inode: 4721101 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 70/postgres) Gid: ( 70/postgres)
Access: 2016-09-30 17:31:21.024617892 +0200
Modify: 2016-09-30 17:31:21.024617892 +0200
Change: 2016-09-30 17:31:21.024617892 +0200
Birth: -
Further details left for the reader.
Francisco Olarte.