can not create trigger with parameter

Поиск
Список
Период
Сортировка
От Rahul Patil
Тема can not create trigger with parameter
Дата
Msg-id 20051215125630.7907.qmail@webmail28.rediffmail.com
обсуждение исходный текст
Список pgsql-novice

Hi,

I'm having trouble getting a trigger to use a parameter,  as in the
following simplified example:

CREATE FUNCTION fun_version_table(varchar)
RETURNS opaque
AS 'DECLARE
   
        in_table_name ALIAS FOR $1;
        v_counter  integer;

        BEGIN
                SELECT INTO v_counter counter FROM version_table
                WHERE table_name = in_table_name;      
-- do something in here
                RETURN new;
        END;'
LANGUAGE 'plpgsql';

CREATE TRIGGER trig_deg_master
AFTER
INSERT OR UPDATE OR DELETE
ON author
FOR EACH ROW
EXECUTE PROCEDURE fun_version_table('degree_master');

Function gets created successfully.But
when I create trigger I get an error:

ERROR:CreateTrigger: function fun_version_table() does not exist

I've created triggers/functions with no parameters and they work fine.

The Postgresql book has some examples of functions with paramters, but
I cannot find anywhere a trigger which calls a function with parameters,

although the users manual indicates that parameters are allowed in the
syntax for CREATE TRIGGER.
 

Regards,
Rahul


В списке pgsql-novice по дате отправления:

Предыдущее
От: "mallikarjun.revgond"
Дата:
Сообщение: how to pass the password value in single statement.
Следующее
От: Miguel
Дата:
Сообщение: Postgresql v 8.0.1-3 problems