X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id CBBC1D1B4FC for ; Wed, 17 Sep 2003 22:21:40 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 10832-06 for ; Wed, 17 Sep 2003 19:21:11 -0300 (ADT) Received: from pns.mm.eutelsat.org (pns.mm.eutelsat.org [194.214.173.227]) by svr1.postgresql.org (Postfix) with ESMTP id 81E94D1B50B for ; Wed, 17 Sep 2003 19:21:07 -0300 (ADT) Received: from nts-03.mm.eutelsat.org (localhost [127.0.0.1]) by pns.mm.eutelsat.org (8.11.6/linuxconf) with ESMTP id h8HLMeP12720; Wed, 17 Sep 2003 23:22:42 +0200 Received: from bigfoot.com (accesspoint.mm.eutelsat.org [194.214.173.4]) by nts-03.mm.eutelsat.org (8.11.6/linuxconf) with ESMTP id h8HMEdR05914; Thu, 18 Sep 2003 00:14:40 +0200 Message-ID: <3F68DE4B.1020302@bigfoot.com> Date: Thu, 18 Sep 2003 00:20:59 +0200 From: Gaetano Mendola User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5b) Gecko/20030901 Thunderbird/0.2 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "pgsql-sql@postgresql.org" Cc: tiagoalves@brturbo.com Subject: Re: Triggers Help... References: <14572644.1063819235613.JavaMail.nobody@webmail2.brturbo.com> In-Reply-To: <14572644.1063819235613.JavaMail.nobody@webmail2.brturbo.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/171 X-Sequence-Number: 15149 tiagoalves@brturbo.com wrote: > Hi, > > I have two databases with the same tables, one is my Real Database and the other is my Log Database. > My Log database does NOT have any kind of keys (PRIMARY or FOREIGN). > > I need to insert from my Real database to my Log database every row that is Updated or Deleted in any Table of the Real database. > > I need to create triggers (BEFORE DELETE or BEFORE UPDATE) to each of my Real database tables, these triggers will INSERT into my Log database table the row that is being deleted or/and updated in the Real Database tables. > > I dont know how to do this? Anyone can help me? What you are looking for is a replication tools, look here: http://www.postgresql.org/news/147.html Regards Gaetano Mendola