On Mon, Apr 11, 2005 at 11:49:22AM -0400, Tom Lane wrote:
> The problem here is that CommitTransaction shuts down the trigger
> manager before shutting down portals, so of course trigger.c barfs
> when the SQL function wants it to check for queued triggers.
>
> There seems to be a rather fundamental ordering problem here,
> since it's certainly possible for a holdable portal to contain
> volatile functions that must fire triggers, and yet I suppose that
> a trigger might also want to use or create cursors. Perhaps we
> have to iterate "close holdable cursors" and "fire triggers" until
> there's nothing more to do. Thoughts anyone?
One further question is if it's right for the holdable portal to fire
trigger at transaction commit. ISTM the non-surprising answer would be
for them to fire at FETCH time. (But of course this is hard to
implement, since at that time we don't have executor machinery ...)
Barring that, yes, maybe the best answer is to iterate between those,
and shut down the trigger manager only after everything's done.
--
Alvaro Herrera (<alvherre[@]dcc.uchile.cl>)
"This is a foot just waiting to be shot" (Andrew Dunstan)