Re: Recursion in triggers? - Mailing list pgsql-general

From Craig Ringer
Subject Re: Recursion in triggers?
Date
Msg-id 4B5C7681.4090900@postnewspapers.com.au
Whole thread Raw
In response to Recursion in triggers?  ("Gauthier, Dave" <dave.gauthier@intel.com>)
Responses Re: Recursion in triggers?  ("Gauthier, Dave" <dave.gauthier@intel.com>)
List pgsql-general
Gauthier, Dave wrote:

> What I need to know is if, in the “after” update trigger I make the
> subsequent updates to other records in the same table, with the OLD/NEW
> record ponters be set properly in those subsequent update trigger
> invocations?

They'll be set properly. I'm not sure they'll be set how you
want/expect, though.

> Will the current and modified NEW.* values be passed down
> into the next update trigger “before” call as OLD.* values?

Eh? Why would they? Your AFTER trigger when fired modifies a different
record, right, rather than modifying the same one again. So why would
the `NEW' and `OLD' variables in the second firing have anything to do
with those in the first firing?

(Or have I misunderstood what you're trying to ask?)

Is your question really one about when the changes become visible? Ie,
if an AFTER UPDATE ... FOR EACH ROW trigger performs an UPDATE on a
table, does the second instance of that same trigger procedure see the
changes made to the first row?

That I can't give you a guaranteed-accurate answer to right now (though
"I think so") ... but suggest that writing a simple test case would be a
a pretty conclusive way to find out if the docs are unclear.

--
Craig Ringer

pgsql-general by date:

Previous
From: "Davor J."
Date:
Subject: Re: Referencing to system catalog problem
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Sugerencia de opcion