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);"

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply via email to