Search Postgresql Archives

Re: Recursion in triggers?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux