[GENERAL] trigger self recursion

2005-09-28 Thread Sim Zacks
Is there a way to avoid trigger self-recursion? In other words, update a table and have the trigger update another row in the same table without calling the same trigger? ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ig

Re: [GENERAL] trigger self recursion

2005-09-28 Thread Martijn van Oosterhout
On Wed, Sep 28, 2005 at 01:41:29PM +0200, Sim Zacks wrote: > Is there a way to avoid trigger self-recursion? > In other words, update a table and have the trigger update another row in > the same table without calling the same trigger? No, although generally it's a sign of a coding problem. If you

Re: [GENERAL] trigger self recursion

2005-09-28 Thread Richard Huxton
Sim Zacks wrote: Is there a way to avoid trigger self-recursion? In other words, update a table and have the trigger update another row in the same table without calling the same trigger? No a per-row trigger will fire for every row updated. There is presumably some test you can make to see wh

Re: [GENERAL] trigger self recursion

2005-09-28 Thread Sim Zacks
Basically I have a table that is not fully normalized. When the user updates a field that has a "duplicate" I would like it to update those duplicate rows as well. The code is very straightforward. Update table1 set f1=new.f1,f2=new.f2,f3=new.f3 where pk<>new.pk and f4=new.f4 and f5=new.f5

Re: [GENERAL] trigger self recursion

2005-09-28 Thread Martijn van Oosterhout
On Wed, Sep 28, 2005 at 02:20:57PM +0200, Sim Zacks wrote: > Basically I have a table that is not fully normalized. When the user > updates a field that has a "duplicate" I would like it to update those > duplicate rows as well. > The code is very straightforward. > > Update table1 set f1=new.

Re: [GENERAL] trigger self recursion

2005-09-28 Thread Sim Zacks
Good point. I don't know how I missed that one. Thank You Sim On Wed, Sep 28, 2005 at 02:20:57PM +0200, Sim Zacks wrote: > Basically I have a table that is not fully normalized. When the user > updates a field that