> ... but that had the same problem. So then I tried:
>
> create function utbl_set_statchangedate() returns opaque as
> 'begin
> IF TG_OP = \'UPDATE\'
> THEN
> NEW.statchangedate := CURRENT_DATE;
> ELSE IF OLD.status <> NEW.status
> THEN
> NEW.statchangedate := CURRENT_DATE;
> END IF;
> return NEW;
> end;
> ' language 'plpgsql';
There is no "else if" in plpgsql, if I remember correctly. Try:
create function utbl_set_statchangedate() returns opaque as
'begin IF TG_OP = ''UPDATE'' THEN NEW.statchangedate := CURRENT_DATE; ELSE IF OLD.status <>
NEW.statusTHEN NEW.statchangedate := CURRENT_DATE; END IF; END IF;
return NEW;
end;
' language 'plpgsql';
-- Joe