What is wrong?
CREATE FUNCTION set_value(text) RETURNS OPAQUE AS '
DECLARE
val ALIAS FOR $1;
BEGIN
NEW.inf := val;
RETURN NEW;
END;
' LANGUAGE 'plpgsql';
CREATE TABLE t1 (
id serial,
info text
);
CREATE TRIGGER t1_set_val BEFORE INSERT ON t1
FOR EACH ROW EXECUTE PROCEDURE set_value('some info');
============================
psql 7.1beta5 result:
CREATE
psql:function_for_trigger.sql:15: NOTICE: CREATE TABLE will create implicit
sequence 't1_id_seq' for SERIAL column 't1.id'
psql:function_for_trigger.sql:15: NOTICE: CREATE TABLE/UNIQUE will create
implicit index 't1_id_key' for table 't1'
CREATE
psql:function_for_trigger.sql:17: ERROR: CreateTrigger: function set_value()
does not exist
test=#
(the language plpgsql is already loaded)