X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5B4C53A4CAE for ; Sun, 23 Jan 2005 19:36:04 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 26406-06 for ; Sun, 23 Jan 2005 19:35:55 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id D6DCE3A4D16 for ; Sun, 23 Jan 2005 19:35:54 +0000 (GMT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.1/8.13.1) with ESMTP id j0NJZpQo011099 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 23 Jan 2005 12:35:54 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.1/8.13.1) with ESMTP id j0NJZplg018636; Sun, 23 Jan 2005 12:35:51 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.1/8.13.1/Submit) id j0NJZps3018635; Sun, 23 Jan 2005 12:35:51 -0700 (MST) (envelope-from mfuhr) Date: Sun, 23 Jan 2005 12:35:51 -0700 From: Michael Fuhr To: Mitchell Laks Cc: pgsql-admin@postgresql.org Subject: Re: how to make a trigger to copy files. Message-ID: <20050123193551.GA18522@winnie.fuhr.org> References: <200501231347.53304.mlaks@verizon.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200501231347.53304.mlaks@verizon.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/241 X-Sequence-Number: 16100 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/