Re: BUG #1592: "with hold" cursor problem

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: andrew(at)supernews(dot)com, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1592: "with hold" cursor problem
Date: 2005-04-11 16:37:38
Message-ID: 20050411163738.GB21340@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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[(at)]dcc(dot)uchile(dot)cl>)
"This is a foot just waiting to be shot" (Andrew Dunstan)

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2005-04-11 16:46:17 Re: BUG #1592: "with hold" cursor problem
Previous Message Tom Lane 2005-04-11 15:49:22 Re: BUG #1592: "with hold" cursor problem