pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Enrico Weigelt <weigelt@metux.de>
To: pgsql-sql <pgsql-sql@postgresql.org>
Subject: trigger/rule question
Date: Wed, 27 Apr 2005 18:56:25 +0200
Message-ID: <20050427165624.GA4253@nibiru.borg.metux.de> (raw)


Hi folks,


for database synchronization I'm maintaining an mtime field in 
each record and I'd like to get it updated automatically on 
normal writes (insert seems trivial, but update not), but it 
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 
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 
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
-- 
---------------------------------------------------------------------
 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/
---------------------------------------------------------------------



view thread (10+ messages)  latest in thread

Message-ID: <20050427165624.GA4253@nibiru.borg.metux.de>
Permalink:  ../20050427165624.GA4253@nibiru.borg.metux.de/
Also on:    postgresql.org/message-id/20050427165624.GA4253@nibiru.borg.metux.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: weigelt@metux.de
  Subject: Re: trigger/rule question
  In-Reply-To: <20050427165624.GA4253@nibiru.borg.metux.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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