From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Vick Khera <vivek(at)khera(dot)org> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: AfterTriggerSaveEvent() called outside of query |
Date: | 2010-11-16 17:40:45 |
Message-ID: | 1603.1289929245@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Vick Khera <vivek(at)khera(dot)org> writes:
> The code looks basically like this, for each owner_id ($oid) targeted
> for the purge:
> BEGIN;
> SET LOCAL synchronous_commit TO OFF;
> SET CONSTRAINTS ALL DEFERRED;
> foreach table (owner_log, ... user_list, invoices, ... )
> DELETE FROM $table WHERE owner_id=$oid
> UPDATE owner SET status='terminated' WHERE owner_id=$oid
> INSERT INTO admin_log (.... record of account being purged ... );
> COMMIT;
> This worked just dandy without the two SET commands above I added
> yesterday to try to speed things up. (Yes, the constraints are marked
> as deferrable...) What happens is now I get the following error:
> ERROR: AfterTriggerSaveEvent() called outside of query
The code comment associated with that error message says:
* Check state. We use normal tests not Asserts because it is possible
* to reach here in the wrong state given misconfigured RI triggers,
* in particular deferring a cascade action trigger.
The system will not normally allow cascade actions to be deferred
... did you manually munge the pg_trigger entries? If you managed
to provoke this purely through DDL commands, that would be a bug,
and I'd like to see how you did it.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Chris Barnes | 2010-11-16 17:41:36 | I want to create a read only database for a specified user. |
Previous Message | Pavel Stehule | 2010-11-16 17:37:00 | Re: median for postgresql 8.3 |