Please.
In the following, is there something I can do so that postgres will
evaluate NEW.qty to NEW.name, treating qty as a variable and evaluating it
before evaluating the field reference? At this time it errors on an INSERT
with: "record new has no field qty".
CREATE FUNCTION func_test() RETURNS opaque AS '
DECLARE
qty varchar(5);
BEGIN
qty := ''name'';
NEW.qty := ''target'';
return new;
END;
' LANGUAGE 'plpgsql';
CREATE TRIGGER func_test_trigger BEFORE INSERT
ON test FOR EACH ROW
EXECUTE PROCEDURE func_test ();