"Jim Fitzgerald" <jfitz@spacelink.com> writes:
> It is notable, however, that Postgres is not emitting the following:
> WARNING: transaction left non-empty SPI stack
> HINT: Check for missing "SPI_finish" calls.
Well, no, because control isn't going to get that far before the
mismatched SPI_connect/SPI_finish calls are noted.
If your theory of the problem were correct then the RI triggers
themselves would cause failures whenever a table had more than one
foreign key. I feel fairly confident that it's just a bug in your
trigger code. Aside from the missing SPI_finish, you might be needing
SPI_push/SPI_pop calls if the trigger code invokes anything that might
itself call SPI.
regards, tom lane