--create table ug(uid int, gid int , uptime varchar(30));
/*
CREATE or Replace FUNCTION func_ug_updateTime() RETURNS trigger
AS
$func_ug_updateTime$
BEGIN
If (TG_OP = 'UPDATE') THEN
If NEW.uptime = OLD.uptime Then
return null;
END IF;
END IF;
update ug set uptime = NOW() where uid = NEW.uid and gid = NEW.gid;
return null;
END;
$func_ug_updateTime$ LANGUAGE plpgsql;
*/
/*
CREATE TRIGGER t_ug_updateTime AFTER INSERT OR UPDATE ON ug
FOR EACH ROW EXECUTE PROCEDURE func_ug_updateTime();
*/
insert into ug values(1,0, '2019-1-21 18:32:28');
Postgres操作之触发器
最新推荐文章于 2024-08-02 17:55:37 发布