postgresql triggers

admin

Administrator
Staff member
hello...

i've the following problem, but i don't know how to solve it.

* i want to EDIT a text in ttest -> the modtime will be changed to the actual date.

* now i've the problem when i want to set the modtime manually that the modtime will be preset by the trigger



the following table structure exists

create table ttest
(
id int4 NOT NULL,
description text,
modtime timestamp default CURRENT_TIMESTAMP,
);


CREATE TRIGGER trg_ttest_modtime
BEFORE INSERT OR UPDATE
ON ttest
FOR EACH ROW
EXECUTE PROCEDURE fnc_modtime();


CREATE FUNCTION fnc_modtime() RETURNS opaque AS'
BEGIN
new.modtime=now();
RETURN new;
END;
'LANGUAGE 'plpgsql';



what can i do ?!
 
Back
Top