Thread: Trigger output to file.

Trigger output to file.

From
Claire McGovern
Date:
Two things...
I'm looking for the syntax to get a trigger function
written in PL/pgSQL to write to a text file.  I want
to be able to append to the file and not open as new
each time I write to it.
Secondly, I'm using pgadmin III to run queries against
my database, I've tried to use the \o option to output
to a file and get an objection about the \o... Any
ideas as to output to a file from this query tool?

Claire



__________________________________
Do you Yahoo!?
Meet the all-new My Yahoo! - Try it today!
http://my.yahoo.com



Re: Trigger output to file.

From
Michael Fuhr
Date:
On Tue, Nov 16, 2004 at 02:32:02AM -0800, Claire McGovern wrote:

> I'm looking for the syntax to get a trigger function
> written in PL/pgSQL to write to a text file.  I want
> to be able to append to the file and not open as new
> each time I write to it.

As far as I know, the only built-in way to write files from PL/pgSQL
is with COPY, which needs a source table and overwrites rather than
appends.  However, you could write a file-appending function in C
or in a procedural language like PL/Perl or PL/Python and call it
from PL/pgSQL.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/