Re: calling plpgsql from c

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Max Jacob <Max(dot)Jacob(at)ircam(dot)fr>, pgsql-hackers(at)postgresql(dot)org, Jan Wieck <JanWieck(at)yahoo(dot)com>
Subject: Re: calling plpgsql from c
Date: 2004-03-17 01:05:39
Message-ID: 200403170105.i2H15dK28332@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> 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?

I have documented SPI_push() and SPI_pop() with the attached SGML patch.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 3.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2004-03-17 01:23:09 Re: [HACKERS] Index creation takes for ever
Previous Message Tom Lane 2004-03-16 22:23:30 Re: Some one deleted pg_database entry how to fix it?