Re: Create trigger for auto update function

From: daq <daq(at)ugyvitelszolgaltato(dot)hu>
To: "Andy" <frum(at)ar-sd(dot)net>
Cc: Pgsql-sql(at)postgresql(dot)org
Subject: Re: Create trigger for auto update function
Date: 2005-07-19 08:10:51
Message-ID: 687885328.20050719101051@ugyvitelszolgaltato.hu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hello Andy,

Tuesday, July 19, 2005, 9:55:41 AM, you wrote:

>> CREATE FUNCTION update_pass() RETURNS integer AS $$
>> UPDATE hoy SET pass_md5=md5(pass) WHERE id=new.id;
>> SELECT 1;
>> $$ LANGUAGE SQL;
>>
>> CREATE TRIGGER triger_users_pass_md5
>> AFTER INSERT OR UPDATE
>> ON hoy FOR EACH ROW
>> EXECUTE PROCEDURE update_pass;

A> I understand the ideea, but don't know how to apply it.
A> I also receive the error that NEW must be definde as a rule.

A> Still... not working...

Sorry! My fault. Trigger porcedure returns OPAQUE type.

CREATE FUNCTION update_pass() RETURNS OPAQUE AS $$
UPDATE hoy SET pass_md5=md5(pass) WHERE id=new.id;
SELECT 1;
$$ LANGUAGE SQL;

DAQ

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2005-07-19 09:11:57 Re: Create trigger for auto update function
Previous Message Andy 2005-07-19 07:55:41 Re: Create trigger for auto update function