The routine's comments need a bit of work too. Otherwise it seems OK. Neil or anyone else --- see an issue here?
The policy will now be: cursor creation is transaction, but cursor state modifications (FETCH) are non-transactional -- right? I wonder if it wouldn't be more consistent to make cursor deletion (CLOSE) transactional as well -- so that a CLOSE in an aborted subtransaction would not actually destroy the cursor.
Other than that, I think there ought to be some user-level documentation for how cursors and savepoints interact, and some regression tests for this behavior, but I'm happy to add that myself if no one beats me to it.
-Neil
---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match