Does the function that returns the trigger automagically have the ability to reference the NEW and OLD pseudo-rows in a before-update trigger designated for each row?
CREATE TRIGGER foo_trigger BEFORE UPDATE ON emp
FOR EACH ROW EXECUTE PROCEDURE foo();
CREATE FUNCTION foo() RETURNS trigger AS $foo_trigger$
BEGIN
NEW.taxrate := 5.5;
RETURN NEW;
END;
$foo_trigger$ LANGUAGE plpgsql;
And must the string inside $....$
in the final line of the function $foo_trigger$ LANGUAGE plpgsql;
exactly match the name of the trigger in the CREATE TRIGGER statement, or is it just a placeholder?