Re: nested SQL with SPI - Mailing list pgsql-general

From Tom Lane
Subject Re: nested SQL with SPI
Date
Msg-id 5864.999544591@sss.pgh.pa.us
Whole thread Raw
In response to nested SQL with SPI  (Markus Wagner <wagner@imsd.uni-mainz.de>)
Responses Re: nested SQL with SPI
List pgsql-general
Markus Wagner <wagner@imsd.uni-mainz.de> writes:
> can I nest SQL statements with SPI within trigger functions?
> How can I distinguish the results in SPI_tuptable?

Yes, but remember that SPI_tuptable is just a global variable.  What
you'll probably need to do is copy it and associated globals into locals
of your function as soon as SPI_exec returns, and then use the local
values to access that result.  In this way, nested executions of
SPI_exec won't confuse your access to your result.

            regards, tom lane

pgsql-general by date:

Previous
From: Fernando Schapachnik
Date:
Subject: Re: SHOW
Next
From: Tom Lane
Date:
Subject: Re: ERROR: Function 'format_type(oid, int4)' does not exist