Re: Creating Functions & Triggers

From: Kevin Lohka <klohka(at)aboutfacedata(dot)ab(dot)ca>
To: aspire420(at)hotpop(dot)com
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Creating Functions & Triggers
Date: 2004-03-21 05:18:32
Message-ID: 3216EBB8-7AF7-11D8-9E77-000A95728606@aboutfacedata.ab.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


On Saturday, March 20, 2004, at 10:23 PM, V i s h a l Kashyap @ [Sai
Hertz And Control Systems] wrote:

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

I'll give it a try.

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

That's correct, when the function & trigger are in place psql just
hangs. It does not accept any input and the only way I know how to
terminate the process is to restart postmaster from another process.

>
> But kindly pass on the solution if you have found one.
>
>
As soon as I find one I will. I'm sure that I just have a simple syntax
error, but I'm too new to know what it is.

Kevin Lohka

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message V i s h a l Kashyap @ [Sai Hertz And Control Systems] 2004-03-21 05:23:31 Re: Creating Functions & Triggers
Previous Message Robert Morgan 2004-03-21 05:08:52 Re: connect from network PC