Re: SPI_ERROR_CONNECT within pl/pgsql, PG 8.4

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Marek Lewczuk <newsy(at)lewczuk(dot)com>
Cc: PGSQL <pgsql-general(at)postgresql(dot)org>
Subject: Re: SPI_ERROR_CONNECT within pl/pgsql, PG 8.4
Date: 2009-07-13 13:33:49
Message-ID: 22050.1247492029@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Marek Lewczuk <newsy(at)lewczuk(dot)com> writes:
>>> I have made an upgrade to PG 8.4 and following error was thrown during
>>> execution of some pl/pgsql function:
>>> ERROR: XX000: SPI_connect failed: SPI_ERROR_CONNECT
>>
> I can't prepare an example, cause I can't reproduce this error in an
> example, but in production database that error occurs. As I wrote
> before, the problem is also that second try of executing a statement,
> that cause an error works just fine, but I don't know whether this is
> executed in the same connection or in the different one, cause my
> application uses connection pooling. How can it be, that pl/pgsql
> looses SPI connection within the middle of some function ?

No, you're misinterpreting the message. What that code likely means
is that something is trying to use SPI and finding plpgsql already
connected. In other words, plpgsql forgets to do a SPI_push() before
calling something that might try to use SPI re-entrantly. It should be
perfectly deterministic and it definitely doesn't have anything to do
with the states of other sessions. But we're going to need a test
case to fix it.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2009-07-13 13:42:08 Re: Request for features
Previous Message Chris Spotts 2009-07-13 13:09:49 Re: Re: [BUGS] BUG #4916: wish: more statistical functions (median, percentiles etc)