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 36AF654B7E for ; Mon, 2 May 2005 00:31:40 -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 21306-08 for ; Mon, 2 May 2005 03:31:38 +0000 (GMT) Received: from metux.de (seven.metux.de [193.16.1.1]) by svr1.postgresql.org (Postfix) with ESMTP id 5614D54B74 for ; Mon, 2 May 2005 00:31:36 -0300 (ADT) Received: (from weigelt@localhost) by metux.de (8.12.10/8.12.10) id j423VYvr012703 for pgsql-sql@postgresql.org; Mon, 2 May 2005 05:31:34 +0200 Date: Mon, 2 May 2005 05:31:34 +0200 From: Enrico Weigelt To: pgsql-sql Subject: Re: trigger/rule question Message-ID: <20050502033134.GD24546@nibiru.borg.metux.de> Reply-To: weigelt@metux.de References: <02767D4600E59A4487233B23AEF5C59922C29D@blrmail1.aus.pervasive.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <02767D4600E59A4487233B23AEF5C59922C29D@blrmail1.aus.pervasive.com> User-Agent: Mutt/1.4.1i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200505/3 X-Sequence-Number: 21316 * Ramakrishnan Muralidharan wrote: Hi, > Going through you mail, I assume that you are updating the mtime > only after inserting the record. An "normal" update (=done by an application or user) should also update the mtime. But there's an replication subsystem, which writes should go through untouched. > It is always possible to check the mtime filed value of the inserted > record and take action based on it in the trigger. yeah, but how to detect whether the application has explicitly written it ? The only chance I currently have in mind is to use some session dependent data, i.e. username or some persistant storage (could be easily done ie. w/ plphp) for this decision. The sync subsystem has to do some "special" login (ie. separate user or setting the session wide variable) before doing its work. I would be happier to let a rule do this, so there's not an extra function per written row. But all my experiments ran into infinite recoursion trouble. > Is it possible to send me detail about the trigger? The trigger isn't existing yet. I'm currently maintaining the mtime updates within the application, but I wanna get away from that. It probably would be interesting, if a normal application couldn't touch the mtime at all. cu -- --------------------------------------------------------------------- Enrico Weigelt == 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/ ---------------------------------------------------------------------