Re: SPI_finish and RegisterExprContextCallback

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Hallgren <thhal(at)mailblocks(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: SPI_finish and RegisterExprContextCallback
Date: 2005-02-18 16:33:24
Message-ID: 18875.1108744404@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thomas Hallgren <thhal(at)mailblocks(dot)com> writes:
> 1. I call a function that does an SPI_connect, SPI_prepare,
> SPI_cursor_open, and finally attempts to do an SPI_cursor_fetch.
> 2. Since the SQL statement I'm executing contains a call to function
> returning SETOF, and since that function in turn accesses the database,
> it in turn will issue a SPI_connect in its SRF_IS_FIRSTCALL phase. It
> then returns its first row.

You're right, you can't just return from that inner function while
leaving its SPI connection open.

It might be interesting to redesign SPI around the notion of independent
"connection objects" rather than necessarily having a stack of 'em.
I think that could be made to work ... but not while preserving the
existing SPI API. I'm hesitant to break a ton of user-written code for
a feature that only one person has needed :-(

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Hallgren 2005-02-18 16:58:32 Re: SPI_finish and RegisterExprContextCallback
Previous Message Doug McNaught 2005-02-18 16:32:02 Re: sigint psql