vanessa escribió: > > Hi guys, > > I was wondering how could i (if at all possible) to use say a command like: > \! touch fred.txt in a function? > i.e. > > CREATE FUNCTION myfunc() RETURNS TRIGGER AS > 'BEGIN > \! touch fred.txt > RETURN NEW; > END;' > LANGUAGE 'plpgsql'; > > At the moment i get: > ERROR: syntax error at or near "\" > Does this mean i should encapsulate the line in quotation marks or something > like that? No, it means you can't do it at all, because backslash commands are psql-only, thus you cannot put them in functions (which are server-executed). PL/pgSQL functions are trusted, meaning you can't access the outside world (disk, network, etc) with them. If you really need to do that, consider using an untrusted language (C, plperlu, etc). I think there's even a PL/sh (shell) but I don't think you can use it for trigger functions. -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support