trigger/rule question

From: Enrico Weigelt <weigelt(at)metux(dot)de>
To: pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: trigger/rule question
Date: 2005-04-27 16:56:25
Message-ID: 20050427165624.GA4253@nibiru.borg.metux.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


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(at)metux(dot)de
---------------------------------------------------------------------
Realtime Forex/Stock Exchange trading powered by postgresSQL :))
http://www.fxignal.net/
---------------------------------------------------------------------

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Rodrigo Carvalhaes 2005-04-27 17:39:53 SYNTAX ERROR ON FOR... LOOP
Previous Message Greg Sabino Mullane 2005-04-27 12:05:49 Re: UPDATE WITH ORDER BY