From: | Bohdan(dot)Linda <Bohdan(dot)Linda(at)seznam(dot)cz> |
---|---|
To: | Bohdan(dot)Linda <Bohdan(dot)Linda(at)seznam(dot)cz> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re:[GENERAL] auditing question - PARTIALY SOLVED |
Date: | 2007-07-11 21:34:00 |
Message-ID: | 1868.2830-30797-75430499-1184189640@seznam.cz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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);"
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-07-11 21:42:43 | Re: Count(*) throws error |
Previous Message | Rodrigo De León | 2007-07-11 21:21:31 | Re: Count(*) throws error |