Skip site navigation (1) Skip section navigation (2)

Re: trigger/rule question

From: Enrico Weigelt <weigelt(at)metux(dot)de>
To: pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: trigger/rule question
Date: 2005-05-02 03:31:34
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
* Ramakrishnan Muralidharan <ramakrishnanm(at)pervasive-postgres(dot)com> wrote:


>     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.

 Enrico Weigelt    ==   metux IT service
  phone:     +49 36207 519931         www:
  fax:       +49 36207 519932         email:     contact(at)metux(dot)de
  Realtime Forex/Stock Exchange trading powered by postgresSQL :))

In response to

pgsql-sql by date

Next:From: Enrico WeigeltDate: 2005-05-02 03:41:00
Subject: Re: trigger/rule question
Previous:From: Tom LaneDate: 2005-05-02 03:04:49
Subject: Re: pgtop, display PostgreSQL processes in `top' style

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group