Re: trigger/rule question

Поиск
Список
Период
Сортировка
От Ramakrishnan Muralidharan
Тема Re: trigger/rule question
Дата
Msg-id 02767D4600E59A4487233B23AEF5C59922C29D@blrmail1.aus.pervasive.com
обсуждение исходный текст
Ответ на trigger/rule question  (Enrico Weigelt <weigelt@metux.de>)
Ответы Re: trigger/rule question  (Enrico Weigelt <weigelt@metux.de>)
Список pgsql-sql
Hi,
   Going through you mail, I assume that you are updating the mtime only after inserting the record. It is always
possibleto check the mtime filed value of the inserted record and take action based on it in the trigger.  
   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
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:
+4936207 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


В списке pgsql-sql по дате отправления:

Предыдущее
От: "Ramakrishnan Muralidharan"
Дата:
Сообщение: Re: people who buy A, also buy C, D, E
Следующее
От: Yasir Malik
Дата:
Сообщение: Re: PHP postgres connections