Re:[GENERAL] auditing question - PARTIALY SOLVED

Поиск
Список
Период
Сортировка
От Bohdan.Linda
Тема Re:[GENERAL] auditing question - PARTIALY SOLVED
Дата
Msg-id 1868.2830-30797-75430499-1184189640@seznam.cz
обсуждение исходный текст
Ответ на auditing question  (Bohdan.Linda <Bohdan.Linda@seznam.cz>)
Список pgsql-general
Hello,

with help of Bricklen, I have found that the problem is the scope of call EXECUTE. When this is called it seems to be
"launched"outside of the trigger's scope and OLD/NEW is not defined. (Manual suggests it) 

The remaining question is how to compare OLD.* and NEW.* in generic way for 8.0.x version

Regards,
Bohdan

>
>     IF TG_OP = 'DELETE' THEN
>         EXECUTE 'INSERT INTO audit.' || TG_RELNAME ||
>                 ' SELECT _name, now(), OLD.*;';
>         RETURN OLD;
> =====================
>
> and binding the procedure to trigger AFTER INSERT,DELETE, UPDATE, gives me
> problem:
>
> ERROR:  NEW used in query that is not in a rule
> CONTEXT:  SQL statement "INSERT INTO audit.communities SELECT _name, now(),
> row(NEW);"

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

Предыдущее
От: Rodrigo De León
Дата:
Сообщение: Re: Count(*) throws error
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Count(*) throws error