Re: BUG #1592: "with hold" cursor problem - Mailing list pgsql-bugs

From Alvaro Herrera
Subject Re: BUG #1592: "with hold" cursor problem
Date
Msg-id 20050411163738.GB21340@dcc.uchile.cl
Whole thread Raw
In response to Re: BUG #1592: "with hold" cursor problem  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #1592: "with hold" cursor problem
List pgsql-bugs
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)

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #1592: "with hold" cursor problem
Next
From: Tom Lane
Date:
Subject: Re: BUG #1592: "with hold" cursor problem