| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> | 
|---|---|
| To: | Mike Nolan <nolan(at)gw(dot)tssi(dot)com> | 
| Cc: | gwood(at)ewebengine(dot)com (Gregory Wood), pgsql-general(at)postgresql(dot)org (pgsql general list) | 
| Subject: | Re: Trigger loop question | 
| Date: | 2004-03-16 04:42:14 | 
| Message-ID: | 12928.1079412134@sss.pgh.pa.us | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
Mike Nolan <nolan(at)gw(dot)tssi(dot)com> writes:
> Yes it does.  OK, that means Tom's original suggestion of checking
> the other table for the same value before updating it should prevent 
> an infinite loop, providing that's done from a pair of 'after update' 
> triggers, using the NEW.column entries in the triggered table to update
> the other table.
Actually, I wasn't thinking very clearly.  The easiest way to break
the loop is to avoid updating the other table when OLD.x = NEW.x
in the trigger's arguments.  The other way requires a rather-redundant
SELECT to see what is in the other table.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Mike Nolan | 2004-03-16 05:00:40 | Re: Trigger loop question | 
| Previous Message | Stephen Robert Norris | 2004-03-16 04:33:31 | Re: Data Corruption in case of abrupt failure |