dbTalk Databases Forums  

How to disable trigger within itself? (to prevent recursion/loop)

comp.databases.postgresql comp.databases.postgresql


Discuss How to disable trigger within itself? (to prevent recursion/loop) in the comp.databases.postgresql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jaroslav Záruba
 
Posts: n/a

Default How to disable trigger within itself? (to prevent recursion/loop) - 11-11-2009 , 03:39 AM






Hello

I have this trigger which ON INSERT inserts more rows into the very
same table it "sits" on. To avoid an INSERT-recursion I would like to
disable all triggers on that table from within my trigger-function.
But what I get is an ERROR saying that I can not alter table because
it is being used.
Is there something I can do about this?
(I do have a workadound, there is one field by which I can tell
whether the insert comes from a trigger or not.)

Best regards
J. Záruba

Reply With Quote
  #2  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: How to disable trigger within itself? (to prevent recursion/loop) - 11-11-2009 , 09:11 AM






Jaroslav Záruba wrote:
Quote:
I have this trigger which ON INSERT inserts more rows into the very
same table it "sits" on. To avoid an INSERT-recursion I would like to
disable all triggers on that table from within my trigger-function.
But what I get is an ERROR saying that I can not alter table because
it is being used.
Is there something I can do about this?
(I do have a workadound, there is one field by which I can tell
whether the insert comes from a trigger or not.)
Your workaround is the only option I can think of.

Yours,
Laurenz Albe

Reply With Quote
  #3  
Old   
Jaroslav Záruba
 
Posts: n/a

Default Re: How to disable trigger within itself? (to prevent recursion/loop) - 11-11-2009 , 09:21 AM



On Nov 11, 4:11*pm, "Laurenz Albe" <inv... (AT) spam (DOT) to.invalid> wrote:
Quote:
Jaroslav Záruba wrote:
I have this trigger which ON INSERT inserts more rows into the very
same table it "sits" on. To avoid an INSERT-recursion I would like to
disable all triggers on that table from within my trigger-function.
But what I get is an ERROR saying that I can not alter table because
it is being used.
Is there something I can do about this?
(I do have a workadound, there is one field by which I can tell
whether the insert comes from a trigger or not.)

Your workaround is the only option I can think of.

Yours,
Laurenz Albe
OK, thank you.
regards
JZ

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.