Re: calling plpgsql from c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Max Jacob <Max(dot)Jacob(at)ircam(dot)fr>
Cc: pgsql-hackers(at)postgresql(dot)org, Jan Wieck <JanWieck(at)Yahoo(dot)com>
Subject: Re: calling plpgsql from c
Date: 2003-11-21 17:57:20
Message-ID: 22673.1069437440@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Max Jacob <Max(dot)Jacob(at)ircam(dot)fr> writes:
> I'm trying to call plpgsql functions from c functions directly through
> the Oid, but i have a problem: it seems that the plpgsql interpreter
> calls SPI_connect and fails even if the caller has already
> spi-connected.

This is a safety check. If you are connected to SPI, you need to call
SPI_push() and SPI_pop() around any operation that might involve
recursive use of SPI. That helps delimit "your" calls versus "their"
calls versus "no man's land".

It does seem that this is quite undocumented though. Jan?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Carlos Guzmán Álvarez 2003-11-21 18:03:42 Re: Transaction Rollback problen (3.0 Protocol)
Previous Message James Rogers 2003-11-21 17:51:07 Re: Sponsoring enterprise features