triggers with parameters

Поиск
Список
Период
Сортировка
От Bryan Buchanan
Тема triggers with parameters
Дата
Msg-id 3B63721A.4F2BF4FC@webbtide.com.au
обсуждение исходный текст
Список pgsql-novice
Hi,

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

CREATE FUNCTION build_xref(text)
RETURNS opaque
AS 'DECLARE

        tablename text;

        BEGIN
                tablename := upper($1);
-- do something in here
                RETURN new;
        END;'
LANGUAGE 'plpgsql';

CREATE TRIGGER credit_terms_xref_trigger
AFTER INSERT
ON credit_terms
FOR EACH ROW
EXECUTE PROCEDURE build_xref('credit_terms');

When I do an insert to the credit_terms table I get an error:

ERROR: function has no parameter $1

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.

Bryan


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

Предыдущее
От: Joel Burton
Дата:
Сообщение: Re: Get name of columns in a table
Следующее
От: Horst Herb
Дата:
Сообщение: access transaction log