functions for triggers: passing parameters - Mailing list pgsql-general

From Nico
Subject functions for triggers: passing parameters
Date
Msg-id 01030918352504.03022@localhost.localdomain
Whole thread Raw
Responses Re: functions for triggers: passing parameters
List pgsql-general
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)

pgsql-general by date:

Previous
From: Tim Frank
Date:
Subject: Postgresql.org website search
Next
From: "Marcelo Pereira"
Date:
Subject: Forein Key