Re: history tables with only one function?

Поиск
Список
Период
Сортировка
От Raphael Bauduin
Тема Re: history tables with only one function?
Дата
Msg-id 411B8A5E.1040207@be.easynet.net
обсуждение исходный текст
Ответ на Re: history tables with only one function?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Tom Lane wrote:
> Raphael Bauduin <raphael.bauduin@be.easynet.net> writes:
>
>>>Could you please confirm that your function works as you described?
>
>
>>It works as expected:
>
>
>>log=# DROP TRIGGER "customers_update_log_t" on "customers";
>>DROP TRIGGER
>>log=# DROP FUNCTION "update_log"();
>>ERROR:  function update_log() does not exist
>>log=# CREATE FUNCTION "update_log"(text) RETURNS trigger AS '
>>log'#  BEGIN
>>log'#         insert into $1_log select new.*,''UPDATE'';
>>log'#         return new;
>>log'#  END;
>>log'#  ' LANGUAGE 'plpgsql';
>>CREATE FUNCTION
>>log=#
>>log=# CREATE TRIGGER "customers_update_log_t" after UPDATE on "customers" for each row execute procedure
"customers_update_log"('customers');
>>CREATE TRIGGER
>
>
> That trigger is not executing that function, and would not be executing
> it even if you had used the same function name.  Trigger functions are
> always parameterless.

I tested it again and it worked, but the fact you were as categoric made me start from scratch, and you are absolutely
right.
As you can even see in the code above, the trigger uses "customers_update_log"('customers') but I define the function
"update_log"().....
There was a parameterless function customers_update_log I had defined in previous tests which hadn't been dropped....
Andthat 
was the function used by the trigger, even if I passed a parameter. The fact that it worked made me think it used the
parameter.

Thanks for the clarification!

Raph



>
>             regards, tom lane


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

Предыдущее
От: Karam Chand
Дата:
Сообщение: Strange pg_hba.conf error (repost)
Следующее
От: Paramveer.Singh@trilogy.com
Дата:
Сообщение: Re: pl pgsql grammer file contains error