Re: Generalized trigger function

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Generalized trigger function
Дата
Msg-id 15606.1150561019@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Generalized trigger function  ("Gang Cheng" <cg1101@gmail.com>)
Список pgsql-novice
"Gang Cheng" <cg1101@gmail.com> writes:
> I'm trying to implement a generalized trigger function that can take as
> arguments the names of columns to be updated with username and timestamp of
> the INSERT/UPDATE event.

This is not possible in plpgsql, primarily because it's a strongly-typed
language and wants to know the datatypes of everything in advance.
You could do it in C for sure, and probably in some of the other PLs
that don't care about datatypes because they convert everything to
strings anyway.  If this trigger is something you intend to apply to all
your tables, for performance reasons you might want to bite the bullet
and do it in C.  There are some examples that do nearly this in
contrib/spi/.

            regards, tom lane

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

Предыдущее
От: "Gang Cheng"
Дата:
Сообщение: Generalized trigger function
Следующее
От: Christopher Browne
Дата:
Сообщение: Re: uh-oh