pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Triggers Help...
2+ messages / 2 participants
[nested] [flat]

* Triggers Help...
@ 2003-09-17 17:20  tiagoalves@brturbo.com
  0 siblings, 1 reply; 2+ messages in thread

From: tiagoalves@brturbo.com @ 2003-09-17 17:20 UTC (permalink / raw)
  To: 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@postgresql.org  Wed Sep 17 16:33:57 2003
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 5AFF7D1B509
	for <pgsql-sql-postgresql.org@localhost.postgresql.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.org@localhost.postgresql.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@postgresql.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@postgresql.org>; Wed, 17 Sep 2003 17:39:32 GMT
	(envelope-from news@news.hub.org)
Received: (from news@localhost)
	by news.hub.org (8.12.9/8.12.9/Submit) id h8HHU8Ln084659
	for pgsql-sql@postgresql.org; Wed, 17 Sep 2003 17:30:08 GMT
Message-ID: <4sgm31-723.ln1@dwnoon.ntlworld.com>
From: David W Noon <dwnoon@spamtrap.ntlworld.com>
Subject: Re: how to get decimal to date form
X-Newsgroups: comp.databases.postgresql.sql
References: <90446ee7.0309170450.2f16d9ef@posting.google.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@ntlworld.com
Organization: ntl Cablemodem News Service
To: pgsql-sql@postgresql.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.0309170450.2f16d9ef@posting.google.com>, wireless
(wireless200@yahoo.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@spamtrap.ntlworld.com (David W Noon)
Remove spam trap to reply via e-mail.
======================================================



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Triggers Help...
@ 2003-09-17 22:20  Gaetano Mendola <mendola@bigfoot.com>
  parent: tiagoalves@brturbo.com
  0 siblings, 0 replies; 2+ messages in thread

From: Gaetano Mendola @ 2003-09-17 22:20 UTC (permalink / raw)
  To: pgsql-sql; +Cc: tiagoalves@brturbo.com

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




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2003-09-17 22:20 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-09-17 17:20 Triggers Help... tiagoalves@brturbo.com
2003-09-17 22:20 ` Gaetano Mendola <mendola@bigfoot.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox