Triggers Help...

From: <tiagoalves(at)brturbo(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Triggers Help...
Date: 2003-09-17 17:20:35
Message-ID: 14572644.1063819235613.JavaMail.nobody@webmail2.brturbo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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?

Thanks,
Tiago Alves
>From pgsql-sql-owner(at)postgresql(dot)org Wed Sep 17 16:33:57 2003
X-Original-To: pgsql-sql-postgresql(dot)org(at)localhost(dot)postgresql(dot)org
Received: from localhost (unknown [64.117.224.130])
by svr1.postgresql.org (Postfix) with ESMTP id 5AFF7D1B509
for <pgsql-sql-postgresql(dot)org(at)localhost(dot)postgresql(dot)org>; Wed, 17 Sep 2003 17:39:43 +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 62048-03
for <pgsql-sql-postgresql(dot)org(at)localhost(dot)postgresql(dot)org>;
Wed, 17 Sep 2003 14:39:33 -0300 (ADT)
Received: from news.hub.org (unknown [64.117.224.194])
by svr1.postgresql.org (Postfix) with ESMTP id BFBF0D1B513
for <pgsql-sql(at)postgresql(dot)org>; Wed, 17 Sep 2003 14:39:32 -0300 (ADT)
Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] (may be forged))
by news.hub.org (8.12.9/8.12.9) with ESMTP id h8HHdUsn085841
for <pgsql-sql(at)postgresql(dot)org>; Wed, 17 Sep 2003 17:39:32 GMT
(envelope-from news(at)news(dot)hub(dot)org)
Received: (from news(at)localhost)
by news.hub.org (8.12.9/8.12.9/Submit) id h8HHU8Ln084659
for pgsql-sql(at)postgresql(dot)org; Wed, 17 Sep 2003 17:30:08 GMT
Message-ID: <4sgm31-723(dot)ln1(at)dwnoon(dot)ntlworld(dot)com>
From: David W Noon <dwnoon(at)spamtrap(dot)ntlworld(dot)com>
Subject: Re: how to get decimal to date form
X-Newsgroups: comp.databases.postgresql.sql
References: <90446ee7(dot)0309170450(dot)2f16d9ef(at)posting(dot)google(dot)com>
Lines: 20
User-Agent: KNode/0.7.2
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7Bit
Date: Wed, 17 Sep 2003 18:05:40 +0100
X-Complaints-To: abuse(at)ntlworld(dot)com
Organization: ntl Cablemodem News Service
To: pgsql-sql(at)postgresql(dot)org
X-Virus-Scanned: by amavisd-new at postgresql.org
X-Archive-Number: 200309/162
X-Sequence-Number: 15140

On Wednesday 17 Sep 2003 13:50 in
<90446ee7(dot)0309170450(dot)2f16d9ef(at)posting(dot)google(dot)com>, wireless
(wireless200(at)yahoo(dot)com) wrote:

> For example where the rec_num is 30608124143.47069519725 the above
> functions return 30608.

Unless you are logging dates around 3 A.D., I suggest you add 2000 to the
number before you apply the TO_CHAR() function.

I strongly suspect your app is not Y2K-compliant. [I haven't written that
for years!]
--
Regards,

Dave [RLU#314465]
======================================================
dwnoon(at)spamtrap(dot)ntlworld(dot)com (David W Noon)
Remove spam trap to reply via e-mail.
======================================================

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Kyle 2003-09-17 19:46:32 Trigger on view
Previous Message Kristian Jörg 2003-09-17 15:21:05 Re: Sort order with spaces?