Markus Wagner <wagner(at)imsd(dot)uni-mainz(dot)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