设计的触发器函数要求当一个字段由空值变为非空值时,对另一个字段赋值当前日期,我写的函数如下
触发器函数:
CREATE FUNCTION production_time()
returns trigger as $$
begin
IF old.storage_real_date is null and new.storage_real_date is not null THEN
set new.storage_act_date = CURRENT_DATE;
END IF;
return new;
end;
$$
language plpgsql;
报错信息:
ERROR: syntax error at or near "CURRENT_DATE"
LINE 5: set new.storage_act_date = CURRENT_DATE;
是哪里错了?