X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6F15254339 for ; Thu, 28 Apr 2005 02:14:08 -0300 (ADT) 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 87059-10 for ; Thu, 28 Apr 2005 05:14:03 +0000 (GMT) Received: from ausimss.pervasive.com (ausimss.pervasive.com [66.45.103.246]) by svr1.postgresql.org (Postfix) with ESMTP id 3508C52956 for ; Thu, 28 Apr 2005 02:14:01 -0300 (ADT) Received: from ausbayes1.aus.pervasive.com ([172.16.8.6]) by ausimss.pervasive.com with InterScan Messaging Security Suite; Thu, 28 Apr 2005 00:13:56 -0500 Received: from ausmail2k3.aus.pervasive.com ([172.16.4.8]) by ausbayes1.aus.pervasive.com with Microsoft SMTPSVC(5.0.2195.6713); Thu, 28 Apr 2005 00:13:55 -0500 Received: from BLRMAIL1.aus.pervasive.com ([10.3.16.60]) by ausmail2k3.aus.pervasive.com with Microsoft SMTPSVC(5.0.2195.6713); Thu, 28 Apr 2005 00:13:55 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 content-class: urn:content-classes:message Subject: Re: trigger/rule question MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Thu, 28 Apr 2005 10:43:45 +0530 Message-ID: <02767D4600E59A4487233B23AEF5C59922C29D@blrmail1.aus.pervasive.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [SQL] trigger/rule question Thread-Index: AcVLTrUBEPCtQjOiSXKYmufl4gCVwgAYuakA From: "Ramakrishnan Muralidharan" To: , "pgsql-sql" X-OriginalArrivalTime: 28 Apr 2005 05:13:55.0202 (UTC) FILETIME=[131EFE20:01C54BB1] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.104 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/411 X-Sequence-Number: 21304 Hi, Going through you mail, I assume that you are updating the mtime = only after inserting the record. It is always possible to check the = mtime filed value of the inserted record and take action based on it in = the trigger.=20 Is it possible to send me detail about the trigger? Regards, R.Muralidharan -----Original Message----- From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org]On Behalf Of Enrico Weigelt Sent: Wednesday, April 27, 2005 10:26 PM To: pgsql-sql Subject: [SQL] trigger/rule question Hi folks, for database synchronization I'm maintaining an mtime field in=20 each record and I'd like to get it updated automatically on=20 normal writes (insert seems trivial, but update not), but it=20 must remain untouched when data is coming in from another node (to prevent sync loops). I first tried it with rules on update, but I didnt find any trick to prevent infinite recoursion. If I'd replace update by delete=20 and reinsert, I'll probably run into trouble with constaints and delete rules. Triggers dont seem to have this problem, but require an function call per record, while a rule solution would only rewrite the=20 actual query. But still I've got the unsolved problem, how to decide when to touch the mtime and when to pass it untouched. I didnt find any trick to explicitly bypass specific triggers yet. Any ideas ? thx --=20 --------------------------------------------------------------------- Enrico Weigelt =3D=3D metux IT service phone: +49 36207 519931 www: http://www.metux.de/ fax: +49 36207 519932 email: contact@metux.de --------------------------------------------------------------------- Realtime Forex/Stock Exchange trading powered by postgresSQL :)) http://www.fxignal.net/ --------------------------------------------------------------------- ---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend