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 1F6133A4D51 for ; Sun, 23 Jan 2005 19:05:12 +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 23321-08 for ; Sun, 23 Jan 2005 19:05:09 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id E3EF63A4D26 for ; Sun, 23 Jan 2005 19:05:09 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j0NJ59g1005465; Sun, 23 Jan 2005 14:05:09 -0500 (EST) To: Mitchell Laks Cc: pgsql-admin@postgresql.org Subject: Re: how to make a trigger to copy files. In-reply-to: <200501231347.53304.mlaks@verizon.net> References: <200501231347.53304.mlaks@verizon.net> Comments: In-reply-to Mitchell Laks message dated "Sun, 23 Jan 2005 13:47:53 -0500" Date: Sun, 23 Jan 2005 14:05:09 -0500 Message-ID: <5464.1106507109@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/240 X-Sequence-Number: 16099 Mitchell Laks writes: > I would like my server to immediately "scp" the file to another machine, as > soon as the application updates the table with the new entry. > But when i look for sample triggers on the web they seem to only do things > internal to the database (change field entries etc, check them for business > logic rules etc). That's generally a good design rule, for the simple reason that a trigger can never know whether the transaction will roll back after it executes. If you change state outside the database then that state may become inconsistent with the database. However, if you can restrict your operations to cases where that won't hurt much, you may be able to get away with it. regards, tom lane