pgsql使用的部分触发器

CREATE FUNCTION

CREATE OR REPLACE FUNCTION fn_update_last_update_time()
  RETURNS trigger AS
$BODY$

BEGIN
  NEW.last_update_time = now(); -- table column last_update_time
  RETURN NEW;
END;

$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;
ALTER FUNCTION fn_update_last_update_time()
  OWNER TO mempb;

CREATE TRIGGER

CREATE TRIGGER update_customer_modtime
  BEFORE UPDATE
  ON bussiness.obj_estate
  FOR EACH ROW
  EXECUTE PROCEDURE fn_update_last_update_time();

你可能感兴趣的:(DB-pgSQL)