I wrote:
> So I think the rule ought to be that cursors
> created inside a failed subtransaction go away.
Other bits of recollection bubbling up: I think that one reason we made
portals not go away instantly on error is that the JDBC guys objected,
feeling that it made for weird special cases at the protocol level.
So the right fix might involve putting the portal into PORTAL_FAILED
state rather than just zapping it completely.
regards, tom lane