Re: how to make a trigger to copy files.

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Mitchell Laks <mlaks(at)verizon(dot)net>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: how to make a trigger to copy files.
Date: 2005-01-23 19:35:51
Message-ID: 20050123193551.GA18522@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Sun, Jan 23, 2005 at 01:47:53PM -0500, Mitchell Laks wrote:

> Could i create a database trigger to run a script like
> system("scp $filename $destination");
> where $filename is extracted from the entry just made into the database, and
> $destination is my other pc?

You can use procedural languages like PL/Perl, PL/Python, PL/Tcl,
etc., to do just about anything those languages allow. Whether
it's appropriate for the database to do certain things is another
matter....

I don't think PostgreSQL 7.4.6 supports trigger functions written
in PL/Perl, but you could write the file-copying function in PL/Perl
and call it from a PL/pgSQL trigger. Or you could upgrade to 8.0.0,
which does support PL/Perl triggers, or you could write the trigger
in one of the other procedural languages.

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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Stephan Szabo 2005-01-24 14:28:47 Re: postgresql 7.4.6 - FATAL Database Startup Message
Previous Message Tom Lane 2005-01-23 19:05:09 Re: how to make a trigger to copy files.