Merge "Preventing cursor leaks when a query is interrupted"