I found another piece of information that might be of interest. This is
related to nested calls and the ExprContextCallback but not related to
nested active cursors.
AtCommitPortals (portalmem.c) iterates over the entries in the
PortalHashTable. This causes a chain of calls that sometimes reach an
ExprContextCallback. If that callback issues a succesfull
SPI_cursor_close some problems might lay ahead. As the AcCommitPortals
iteration continues, it sometimes encounter a deleted portal and elogs
with an error stating "trying to delete portal name that does not exist".
Regards,
Thomas Hallgren