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

Re: Creating Functions & Triggers

From: "V i s h a l Kashyap (at) [Sai Hertz And Control Systems]" <sank89(at)sancharnet(dot)in>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Creating Functions & Triggers
Date: 2004-03-21 05:23:31
Message-ID: 405D26D3.5010503@sancharnet.in (view raw or flat)
Thread:
Lists: pgsql-novice
Dear Kevin  ,

>>
>> Yes, you can set the default value for update of a record
>> just with
>>
>> UPDATE email SET  m_date = DEFAULT, m_by_user = DEFAULT  WHERE id = 
>> some_id;
>
>
> If I use this method, I will need to control the input from the client 
> side.  I was hoping to have an easy way to update the record with the 
> last date modified and user who modified the record regardless of 
> where the modification came from.  eg. Web or internal client software.

If the below query is issed by the web client then your job could be 
done by the said above query as well .
To my limited knowledge  no need to write a trigger.
Just try using this

CREATE FUNCTION email_mod_date() RETURNS TRIGGER AS
                                                                         
            ^^^^^^^^     

>>
>
> acc=# UPDATE email SET email_address = 'mynewusername(at)mydomain(dot)com' 
> WHERE id = 14;
> -------------
> UPDATE 1

I suppose this is update has been done without the trigger in place.

To my limited knowledge is the trigger going into a sort of race condition

>
> Thank you for your time Vishal.


Oh!,
Its my pleaseure.

But kindly  pass on the solution if you have found one.

-- 
Best Regards,
Vishal Kashyap
Director / Lead Developer,
Sai Hertz And Control Systems Pvt Ltd,
http://saihertz.rediffblogs.com
Jabber IM: vishalkashyap(at)jabber(dot)org
ICQ :      264360076
Yahoo  IM: mailforvishal(at)yahoo(dot)com
-----------------------------------------------
You yourself, as much as anybody in the entire
universe, deserve your love and affection.
- Buddha
---------------
pgsql=# select marital_status from vishals_life;

marital_status
------------------
Single not looking

1 Row(s) affected

                    ___
                   //\\\
                  ( 0_0 )
----------------o0o-----o0o---------------------


In response to

Responses

pgsql-novice by date

Next:From: Markus BertheauDate: 2004-03-21 09:37:53
Subject: Re: Creating Functions & Triggers
Previous:From: Kevin LohkaDate: 2004-03-21 05:18:32
Subject: Re: Creating Functions & Triggers

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